function __my_trace(args){args=" [JS] "+args;};function __my_assert(args){if(!args)__my_trace("ERRORRRRRRRRR!");};var browser_version_internet_explorer=(function(){var undef,v=3,div=document.createElement('div'),all=div.getElementsByTagName('i');while(div.innerHTML='<!--[if gt IE '+(++v)+']><i></i><![endif]-->',all[0]);return v>4?v:undef;}());function is_internet_explorer(){var ie_ver=browser_version_internet_explorer;if(ie_ver!=undefined)return true;else return false;};function Debug(){t=this;t.width=340;t.height=240;t.color="#0D53C8";t.fontFamily="arial";t.fontSize="12px";t.isMouseDown=false;t.debugContainer=null;t.commandsQueue=new Array();Debug.init()};Debug.toString=function(){return "debug"};Debug.init=function(){t.debugContainer=document.createElement('div');var _div=t.debugContainer;_div.setAttribute("id","DebugWindowDiv");_div.style.position="absolute";_div.style.zIndex=1000;_div.style.top="40px";_div.style.left="40px";_div.style.width=t.width+"px";_div.style.height=t.height+"px";var innerHTML;_div.innerHTML="<Table id='DebugWindowTable' width='100%' height='100%' style='border-collapse: collapse;'><TR onSelectStart='return false' style='cursor:move;background-color:#1064C9;' ondblclick='Debug.toggle()' onmousedown='Debug.onMouseDown(event)' onmouseup='Debug.onMouseUp(event)' onmouseover='this.style.backgroundColor=\"#3A74E9\"' onmouseout='this.style.backgroundColor=\"#1064C9\"'><TD height='20' style='color:#FFFFFF;padding-left:4px;font-family:trebuchet ms;font-size:12px'><B>Debug Window</B>:</TD><TD Align='Right' style='color:#FFFFFF;padding-right:6px;'><span onclick='Debug.clear(true)' style='cursor:pointer;font-family:arial;font-size:12px'><B>X</B></span></TD></TR><TR id ='aaaaaaaaaaa'><TD colspan='2' style='padding-left:5px;' width='100%' height='100%'><div id='DebugWindowDivBody' style='background-color:#FFFFFF;width:100%;height:100%;overflow-Y:auto;overflow-X:auto'><Table id='DebugWindowTableBody' cellspacing='3'></Table></div></TD></TR></Table>";_div.style.backgroundColor="#FFFFFF";_div.style.border="1px solid #276592";_div.style.display='none'};Debug.appendToDocument=function(){document.body.appendChild(t.debugContainer);doCommandsQueue()};Debug.writeTo=function(_color){if(t.debugContainer.style.display=='none'){t.debugContainer.style.display=''}if(!document.all){document.getElementById("DebugWindowDivBody").style.height=parseInt(t.height-22)+"px";document.getElementById("DebugWindowDivBody").style.width=parseInt(t.width-5)+"px"}var tbl=document.getElementById('DebugWindowTableBody');var lastRow=tbl.rows.length;var iteration=lastRow;var row=tbl.insertRow(lastRow);var cell=row.insertCell(0);cell.setAttribute("width",t.width);cell.setAttribute("height",16);if((_color==null)||(_color==""))_color=t.color;else _color="#"+_color;cell.style.color=_color;cell.style.fontFamily=t.fontFamily;cell.style.fontSize=t.fontSize;cell.style.borderBottom="1px solid #CEE2FB";return cell;};Debug.write=function(_text,_color){if(document.body){var cell=Debug.writeTo(_color);cell.appendChild(document.createTextNode(_text));var _div=document.getElementById("DebugWindowDivBody");_div.scrollTop=_div.scrollHeight}else{addCommandToQueue(Debug.write,arguments)}};Debug.writeHTML=function(_html){if(document.body){var cell=Debug.writeTo();cell.innerHTML=_html;var _div=document.getElementById("DebugWindowDivBody");_div.scrollTop=_div.scrollHeight}else{addCommandToQueue(Debug.write,arguments)}};Debug.clear=function(_close){if(document.body){var tbl=document.getElementById('DebugWindowTableBody');while(tbl.rows.length>0){tbl.deleteRow(0);}if(_close){t.debugContainer.style.display='none'}}else{addCommandToQueue(Debug.clear,arguments)}};Debug.setPosition=function(_screenCoordinate){t.debugContainer.style.top=_screenCoordinate.y+"px";t.debugContainer.style.left=_screenCoordinate.x+"px";};Debug.setTextStyle=function(_font,_fontSize,_color){t.color=_color;t.fontFamily=_font;t.fontSize=_fontSize+"px"};Debug.setSize=function(_width,_height){_height=_height+20;t.debugContainer.style.width=_width+"px";t.debugContainer.style.height=_height+"px";t.width=_width;t.height=_height};Debug.minimize=function(){DebugWindowDivBody.style.display='none';t.debugContainer.style.height=22+"px"};Debug.maximize=function(){DebugWindowDivBody.style.display='';t.debugContainer.style.height=t.height+"px";var _div=document.getElementById("DebugWindowDivBody");_div.scrollTop=_div.scrollHeight};Debug.toggle=function(){if(DebugWindowDivBody.style.display==''){Debug.minimize();}else{Debug.maximize();}};Debug.onMouseDown=function(evt){t.isMouseDown=true;t.offsetX=(document.all)?event.clientX:evt.clientX;t.offsetY=(document.all)?event.clientY:evt.clientY;t.pressedX=parseInt(t.debugContainer.style.left);t.pressedY=parseInt(t.debugContainer.style.top);if(document.addEventListener){document.addEventListener("mousemove",Debug.moveWindow,false);}else if(document.attachEvent){document.attachEvent("onmousemove",Debug.moveWindow);}else{document.onmousemove=Debug.moveWindow;}};Debug.onMouseUp=function(){t.isMouseDown=false;if(document.removEventListener){document.removEventListener("mousemove",Debug.moveWindow,false);}else if(document.detachEvent){document.detachEvent("onmousemove",Debug.moveWindow);}else{document.onmousemove=null;}};Debug.moveWindow=function(evt){if(t.isMouseDown){t.debugContainer.style.left=(document.all)?t.pressedX+event.clientX-t.offsetX:t.pressedX+evt.clientX-t.offsetX;t.debugContainer.style.top=(document.all)?t.pressedY+event.clientY-t.offsetY:t.pressedY+evt.clientY-t.offsetY;if(!document.all){document.getElementById("DebugWindowDivBody").style.height=parseInt(t.height-22)+"px";document.getElementById("DebugWindowDivBody").style.width=parseInt(t.width-5)+"px"}}};var addCommandToQueue=function(fun,arg){t.commandsQueue.push(fun);t.commandsQueue.push(arg)};var doCommandsQueue=function(){var i;var count=t.commandsQueue.length;for(i=0;i<count;i=i+2){fun=t.commandsQueue[i];arg=t.commandsQueue[i+1];fun.apply(this,arg)}};Debug();if(!is_internet_explorer()){window.addEventListener("load",Debug.appendToDocument,false);}else if(window.attachEvent){window.attachEvent("onload",Debug.appendToDocument);}else{window.onload=Debug.appendToDocument;};function Encoding(){var t=this;t.fixTextForUTF8=function(_txt){var txt=_txt;if((clientSettings.defaultEncoding.toLowerCase()=="utf-8")||(clientSettings.defaultEncoding.toLowerCase()=="utf8")){txt=t.utf8Encode(txt);txt=t.URLEncode(txt);}else txt=t.encodeStr(txt);return txt;};t.utf8Encode=function(argString){var string=(argString+'').replace(/\r\n/g,"\n").replace(/\r/g,"\n");var utftext="";var start,end;var stringl=0;start=end=0;stringl=string.length;for(var n=0;n<stringl;n++){var c1=string.charCodeAt(n);var enc=null;if(c1<128){end++;}else if((c1>127)&&(c1<2048)){enc=String.fromCharCode((c1>>6)|192)+String.fromCharCode((c1&63)|128);}else{enc=String.fromCharCode((c1>>12)|224)+String.fromCharCode(((c1>>6)&63)|128)+String.fromCharCode((c1&63)|128);}if(enc!==null){if(end>start){utftext+=string.substring(start,end);}utftext+=enc;start=end=n+1;}}if(end>start){utftext+=string.substring(start,string.length);}return utftext;};t.URLEncode=function(clearString){var output='';var x=0;clearString=clearString.toString();var regex=/(^[a-zA-Z0-9_.]*)/;while(x<clearString.length){var match=regex.exec(clearString.substr(x));if(match!=null&&match.length>1&&match[1]!=''){output+=match[1];x+=match[1].length;}else{if(clearString[x]==' ')output+='+';else{var charCode=clearString.charCodeAt(x);var hexVal=charCode.toString(16);output+='%'+(hexVal.length<2?'0':'')+hexVal.toUpperCase();}x++;}}return output;};t.encodeStr=function(str){var i;var charset;var ch;var newStr;var c=Array(30);c['\u05d0']='%E0';c['\u05d1']='%E1';c['\u05d2']='%E2';c['\u05d3']='%E3';c['\u05d4']='%E4';c['\u05d5']='%E5';c['\u05d6']='%E6';c['\u05d7']='%E7';c['\u05d8']='%E8';c['\u05d9']='%E9';c['\u05DA']='%EA';c['\u05DB']='%EB';c['\u05DC']='%EC';c['\u05DD']='%ED';c['\u05DE']='%EE';c['\u05DF']='%EF';c['\u05E0']='%F0';c['\u05E1']='%F1';c['\u05E2']='%F2';c['\u05E3']='%F3';c['\u05E4']='%F4';c['\u05E5']='%F5';c['\u05E6']='%F6';c['\u05E7']='%F7';c['\u05E8']='%F8';c['\u05E9']='%F9';c['\u05EA']='%FA';i=0;newStr='';if((str!=null)&&(str!=undefined)){while(i<str.length){ch=str.charAt(i);if(c[ch]!=null)newStr+=c[ch];else newStr+=ch;i+=1;}}return newStr;}};var encoding=new Encoding();;function Projector(){var t=this;var projectionsArray=new Array();t.addProjection=function(_projection){projectionsArray.push(_projection)};t.setDefaultProjections=function(mapCoordSystem,clientCoordSystem){var source;var destination;for(i=0;i<projectionsArray.length;i++){source=projectionsArray[i].fromSystem;destination=projectionsArray[i].toSystem;if((source==mapCoordSystem)&&(destination==clientCoordSystem)){toSystemFunction=projectionsArray[i].projectToMapSystem}else{if((source==clientCoordSystem)&&(destination==mapCoordSystem)){fromSystemFunction=projectionsArray[i].projectFromMapSystem}}}t.fromMapSystem=fromSystemFunction;t.toMapSystem=toSystemFunction};t.setClientCoordinate=function(createClientCoordinate){t.createClientCoordinate=createClientCoordinate};t.fromMapSystem=function(coordinate){return coordinate};t.toMapSystem=function(coordinate){return coordinate};t.createClientCoordinate=function(){return null}};projector=new Projector();Projector.ITM="itm";Projector.ITM_MAPA="itmmapa";Projector.LAT_LONG="ltlg";Projector.LAT_LONG_ATLAS="ltlgatlas";Projector.MERCATOR="mercator";Projector.WEB_MERCATOR="webmercator_atlas";Projector.SPHERICAL_MERCATOR="spherical_mercator";mapCoordSystem=Projector.ITM;clientCoordSystem=Projector.LAT_LONG;function Coordinate(_x,_y){var t=this;var mapX=_x;var mapY=_y;t.isConverted=false;this.type="coordinate";t.setCoordinate=function(x,y){t.isConverted=false;mapX=x;mapY=y};t.getMapX=function(){return mapX};t.getMapY=function(){return mapY};this.toString=function(){return "coordinate"}};ItmCoordinate.prototype=new Coordinate();function ItmCoordinate(_x,_y){this.Coordinate=Coordinate;this.Coordinate();this.x=_x;this.y=_y;this.toString=function(){return "itmCoordinate"}};LatLong.prototype=new Coordinate();function LatLong(_lat,_lon){var t=this;this.Coordinate=Coordinate;this.Coordinate();var lat=_lat;var lon=_lon;if(_lat!=null&&_lon!=null){var p=projector.toMapSystem(_lat,_lon);t.setCoordinate(p.getMapX(),p.getMapY())}var projectFromSystem=function(){var p=projector.fromMapSystem(t.getMapX(),t.getMapY());lat=p.lat;lon=p.lon;t.isConverted=true};t.setLatLon=function(_lat,_lon){lat=_lat;lon=_lon};t.getLat=function(){if(!t.isConverted)projectFromSystem();return lat};t.getLong=function(){if(!t.isConverted)projectFromSystem();return lon};this.toString=function(){return "latLong"}};function LatLongToMercatorProjection(){var t=this;t.fromSystem=Projector.LAT_LONG;t.toSystem=Projector.MERCATOR;function coordinateRecord(x,y){this.x=x;this.y=y};t.projectToMapSystem=function(lat,lon){var itmCoordinate=t.project(lat,lon);return new Coordinate(itmCoordinate.x,itmCoordinate.y)};t.projectFromMapSystem=function(mapX,mapY){return t.project(mapX,mapY)};t.project=function(lat,lon){var horzPos,vertPos;horzPos=lon*100000;d=Math.min(0.99999999,Math.max(-0.99999999,Math.sin((lat)*Math.PI/180)));vertPos=(0.5*Math.log((1+d)/(1-d))*180/Math.PI)* -100000;return new coordinateRecord(horzPos,vertPos)}};function MercatorToLatLongProjection(){var t=this;t.fromSystem=Projector.MERCATOR;t.toSystem=Projector.LAT_LONG;function coordinateRecord(lat,lon){this.lat=lat;this.lon=lon};t.projectToMapSystem=function(coordinate){var latLong=t.project(coordinate.x,coordinate.y);return new Coordinate(latLong.lat,latLong.lon)};t.projectFromMapSystem=function(mapX,mapY){return t.project(mapX,mapY)};t.project=function(horzPos,vertPos){var lat,lon;lon=horzPos/100000;vertPos=vertPos/ -100000;lat=(2*Math.atan(Math.exp(vertPos*Math.PI/180))-Math.PI/2)*180/Math.PI;return new coordinateRecord(lat,lon)}};function LatLongToWebMercatorProjection(){var t=this;t.fromSystem=Projector.LAT_LONG;t.toSystem=Projector.WEB_MERCATOR;function coordinateRecord(x,y){this.x=x;this.y=y};t.projectToMapSystem=function(lat,lon){var itmCoordinate=t.project(lat,lon);return new Coordinate(itmCoordinate.x,itmCoordinate.y)};t.projectFromMapSystem=function(mapX,mapY){return t.project(mapX,mapY)};t.project=function(lat,lon){var horzPos,vertPos;originShift=2*Math.PI*6378137/2.0;var _lat=parseFloat(lat);var _lon=parseFloat(lon);horzPos=_lon*originShift/180.0;vertPos=Math.log(Math.tan((90+_lat)*Math.PI/360.0))/(Math.PI/180.0);vertPos= -1*(vertPos*originShift/180.0);return new coordinateRecord(horzPos,vertPos)}};function WebMercatorToLatLongProjection(){var t=this;t.fromSystem=Projector.WEB_MERCATOR;t.toSystem=Projector.LAT_LONG;function coordinateRecord(lat,lon){this.lat=lat;this.lon=lon};t.projectToMapSystem=function(coordinate){var latLong=t.project(coordinate.x,coordinate.y);return new Coordinate(latLong.lat,latLong.lon)};t.projectFromMapSystem=function(mapX,mapY){return t.project(mapX,mapY)};t.project=function(horzPos,vertPos){var lat,lon;originShift=2*Math.PI*6378137/2.0;lon=(horzPos/originShift)*180.0;lat=(vertPos/originShift)*180.0;lat= -180/Math.PI*(2*Math.atan(Math.exp(lat*Math.PI/180.0))-Math.PI/2.0);return new coordinateRecord(lat,lon);}};function LatLongToSphericalMercatorProjection(){var t=this;t.fromSystem=Projector.LAT_LONG;t.toSystem=Projector.SPHERICAL_MERCATOR;function coordinateRecord(x,y){this.x=x;this.y=y};t.projectToMapSystem=function(lat,lon){var itmCoordinate=t.project(lat,lon);return new Coordinate(itmCoordinate.x,itmCoordinate.y)};t.projectFromMapSystem=function(mapX,mapY){return t.project(mapX,mapY)};t.project=function(lat,lon){var r_major=6378137.000;var r_minor=6356752.3142;horzPos=r_major*(lon*(Math.PI/180.0));if(lat>89.5)lat=89.5;if(lat< -89.5)lat= -89.5;var temp=r_minor/r_major;var es=1.0-(temp*temp);var eccent=Math.sqrt(es);var phi=lat*(Math.PI/180.0);var sinphi=Math.sin(phi);var con=eccent*sinphi;var com=.5*eccent;con=Math.pow(((1.0-con)/(1.0+con)),com);var ts=Math.tan(.5*((Math.PI*0.5)-phi))/con;var y=0-r_major*Math.log(ts);vertPos= -y;return new coordinateRecord(horzPos,vertPos)}};function SphericalMercatorToLatLongProjection(){var t=this;t.fromSystem=Projector.SPHERICAL_MERCATOR;t.toSystem=Projector.LAT_LONG;function coordinateRecord(lat,lon){this.lat=lat;this.lon=lon};t.projectToMapSystem=function(coordinate){var latLong=t.project(coordinate.x,coordinate.y);return new Coordinate(latLong.lat,latLong.lon)};t.projectFromMapSystem=function(mapX,mapY){return t.project(mapX,mapY)};t.project=function(horzPos,vertPos){R_MAJOR=6378137.0;R_MINOR=6356752.3142;var lat,lon;lon=horzPos/R_MAJOR;lat=180/Math.PI*(2*Math.atan(Math.exp(vertPos*Math.PI/180))-Math.PI/2);return new coordinateRecord(lat,lon);}};function LatLongToItmProjection(){var t=this;t.fromSystem=Projector.LAT_LONG;t.toSystem=Projector.ITM;function coordinateRecord(x,y){this.x=x;this.y=y};t.projectToMapSystem=function(lat,lon){var itmCoordinate=t.project(lat,lon);return new Coordinate(itmCoordinate.x,itmCoordinate.y)};t.projectFromMapSystem=function(mapX,mapY){return t.project(mapX,mapY)};t.project=function(lat,lon){var horzPos,vertPos;var point=gIStools.LTLGtoITM(lat,lon);return new coordinateRecord(point.horzPos,point.vertPos)}};function ItmToLatLongProjection(){var t=this;t.fromSystem=Projector.ITM;t.toSystem=Projector.LAT_LONG;function coordinateRecord(lat,lon){this.lat=lat;this.lon=lon};t.projectToMapSystem=function(coordinate){var latLong=t.project(coordinate.x,coordinate.y);return new Coordinate(latLong.lat,latLong.lon)};t.projectFromMapSystem=function(mapX,mapY){return t.project(mapX,mapY)};t.project=function(horzPos,vertPos){var lat,lon;var point=gIStools.ITMtoLTLG(horzPos,vertPos);return new coordinateRecord(point.vertPos,point.horzPos)}};function LatLongToItmMapaProjection(){var t=this;t.fromSystem=Projector.LAT_LONG;t.toSystem=Projector.ITM_MAPA;function coordinateRecord(x,y){this.x=x;this.y=y};t.projectToMapSystem=function(lat,lon){var itmCoordinate=t.project(lat,lon);return new Coordinate(itmCoordinate.x,itmCoordinate.y)};t.projectFromMapSystem=function(mapX,mapY){return t.project(mapX,mapY)};t.project=function(lat,lon){var horzPos,vertPos;var point=gIStools.LTLGtoITMMapa(lat,lon);return new coordinateRecord(point.horzPos,point.vertPos)}};function ItmMapaToLatLongProjection(){var t=this;t.fromSystem=Projector.ITM_MAPA;t.toSystem=Projector.LAT_LONG;function coordinateRecord(lat,lon){this.lat=lat;this.lon=lon};t.projectToMapSystem=function(coordinate){var latLong=t.project(coordinate.x,coordinate.y);return new Coordinate(latLong.lat,latLong.lon)};t.projectFromMapSystem=function(mapX,mapY){return t.project(mapX,mapY)};t.project=function(horzPos,vertPos){var lat,lon;var point=gIStools.ITMMapaToLTLG(horzPos,vertPos);return new coordinateRecord(point.vertPos,point.horzPos)}};function LatLongToAtlasLatLongProjection(){var t=this;t.fromSystem=Projector.LAT_LONG;t.toSystem=Projector.LAT_LONG_ATLAS;function coordinateRecord(x,y){this.x=x;this.y=y};t.projectToMapSystem=function(lat,lon){var coord=t.project(lat,lon);return new Coordinate(coord.x,coord.y)};t.projectFromMapSystem=function(mapX,mapY){return t.project(mapX,mapY)};t.project=function(lat,lon){var horzPos,vertPos;horzPos=lon*100000;vertPos=lat* -100000;return new coordinateRecord(horzPos,vertPos)}};function AtlasLatLongToLatLongProjection(){var t=this;t.fromSystem=Projector.LAT_LONG_ATLAS;t.toSystem=Projector.LAT_LONG;function coordinateRecord(lat,lon){this.lat=lat;this.lon=lon};t.projectToMapSystem=function(coordinate){var latLong=t.project(coordinate.x,coordinate.y);return new Coordinate(latLong.lat,latLong.lon)};t.projectFromMapSystem=function(mapX,mapY){return t.project(mapX,mapY)};t.project=function(horzPos,vertPos){var lat,lon;lon=horzPos/100000;lat=vertPos/ -100000;return new coordinateRecord(lat,lon)}};projector.addProjection(new LatLongToAtlasLatLongProjection());projector.addProjection(new AtlasLatLongToLatLongProjection());projector.addProjection(new LatLongToMercatorProjection());projector.addProjection(new MercatorToLatLongProjection());projector.addProjection(new LatLongToWebMercatorProjection());projector.addProjection(new WebMercatorToLatLongProjection());projector.addProjection(new LatLongToSphericalMercatorProjection());projector.addProjection(new SphericalMercatorToLatLongProjection());projector.addProjection(new LatLongToItmProjection());projector.addProjection(new ItmToLatLongProjection());projector.addProjection(new LatLongToItmMapaProjection());projector.addProjection(new ItmMapaToLatLongProjection());switch(clientCoordSystem){case Projector.ITM:projector.setClientCoordinate(function createClientCoordinate(x,y){var p=new ItmCoordinate();p.setCoordinate(x-0,y-0);return p});break;case Projector.LAT_LONG:projector.setClientCoordinate(function createClientCoordinate(x,y){var p=new LatLong();p.setCoordinate(x-0,y-0);return p;});break;}function GIStools(){var t=this;var Sqr=function(x){return Math.pow(x,0.5);};var Marc=function(bf0,n,PHI0,PHI){n2=n*n;return bf0*(((1+n+((5/4)*(n2))+((5/4)*(n2*n)))*(PHI-PHI0))-(((3*n)+(3*(n2))+((21/8)*(n2*n)))*(Math.sin(PHI-PHI0))*(Math.cos(PHI+PHI0)))+((((15/8)*(n2))+((15/8)*(n2*n)))*(Math.sin(2*(PHI-PHI0)))*(Math.cos(2*(PHI+PHI0))))-(((35/24)*(n2*n))*(Math.sin(3*(PHI-PHI0)))*(Math.cos(3*(PHI+PHI0)))))};var InitialLat=function(North,n0,afo,PHI0,n,bfo){PHI1=((North-n0)/afo)+PHI0;M=Marc(bfo,n,PHI0,PHI1);PHI2=((North-n0-M)/afo)+PHI1;while(Math.abs(North-n0-M)>0.000000001){PHI2=((North-n0-M)/afo)+PHI1;M=Marc(bfo,n,PHI0,PHI2);PHI1=PHI2;}return PHI2;};var East_North_to_Lat_Long=function(East,North,a,b,e0,n0,f0,PHI0,LAM0){Pi=4*Math.atan(1);RadPHI0=PHI0*(Pi/180);RadLAM0=LAM0*(Pi/180);af0=a*f0;bf0=b*f0;af02=af0*af0;bf02=bf0*bf0;e2=((af02)-(bf02))/(af02);n=(af0-bf0)/(af0+bf0);Et=East-e0;Et2=Et*Et;PHId=InitialLat(North,n0,af0,RadPHI0,n,bf0);SinPHId2=Math.sin(PHId)*Math.sin(PHId);nu=af0/(Sqr(1-(e2*(SinPHId2))));nu2=nu*nu;rho=(nu*(1-e2))/(1-(e2*SinPHId2));eta2=(nu/rho)-1;TanPHId=Math.tan(PHId);TanPHId2=TanPHId*TanPHId;VII=(Math.tan(PHId))/(2*rho*nu);VIII=((Math.tan(PHId))/(24*rho*(nu2*nu)))*(5+(3*(TanPHId2))+eta2-(9*eta2*(TanPHId2)));IX=((Math.tan(PHId))/(720*rho*(nu2*nu2*nu)))*(61+(90*(TanPHId2))+(45*(TanPHId2*TanPHId2)));X=(1/Math.cos(PHId))/nu;XI=((1/Math.cos(PHId))/(6*(nu2*nu)))*((nu/rho)+(2*(TanPHId2)));XII=((1/Math.cos(PHId))/(120*(nu2*nu*nu2)))*(5+(28*(TanPHId2))+(24*(TanPHId2*TanPHId2)));XIIA=((1/Math.cos(PHId))/(5040*(nu2*nu*nu2*nu2)))*(61+(662*(TanPHId2))+(1320*(TanPHId2*TanPHId2))+(720*(TanPHId2*TanPHId2*TanPHId2)));var point={vertPos:0,horzPos:0};point.horzPos=(180/Pi)*(RadLAM0+(Et*X)-((Et2*Et)*XI)+((Et2*Et2*Et)*XII)-((Et2*Et2*Et2*Et)*XIIA));point.vertPos=(180/Pi)*(PHId-((Et2)*VII)+((Et2*Et2)*VIII)-((Et2*Et2*Et2)*IX));return point;};var TranMerc_Origin_Lat,TranMerc_Origin_Long,TranMerc_False_Northing,TranMerc_False_Easting,TranMerc_Scale_Factor,RAD_PER_DEG,Pi;PI=Math.PI;RAD_PER_DEG=PI/180.0;var MAX_LAT=((PI*90.0)/180.0);var MAX_DELTA_LONG=((PI*90.0)/180.0);var MIN_SCALE_FACTOR=0.3;var MAX_SCALE_FACTOR=3.0;var TranMerc_a=6378137.0;var TranMerc_f=1/298.257223563;var TranMerc_es=0.0066943799901413800;var TranMerc_ebs=0.0067394967565869;var TranMerc_ap=6367449.1458008;var TranMerc_bp=16038.508696861;var TranMerc_cp=16.832613334334;var TranMerc_dp=0.021984404273757;var TranMerc_ep=3.1148371319283e-005;var TranMerc_Delta_Easting=40000000.0;var TranMerc_Delta_Northing=40000000.0;var Sqr2=function(x){return Math.pow(x,0.5);};var SPHTMD=function(Latitude){return(TranMerc_ap*Latitude-TranMerc_bp*Math.sin(2.e0*Latitude)+TranMerc_cp*Math.sin(4.e0*Latitude)-TranMerc_dp*Math.sin(6.e0*Latitude)+TranMerc_ep*Math.sin(8.e0*Latitude))};var SPHSN=function(Latitude){return(TranMerc_a/Sqr2(1.e0-TranMerc_es*Math.pow(Math.sin(Latitude),2)))};var SPHSR=function(Latitude){return(TranMerc_a*(1.e0-TranMerc_es)/Math.pow(DENOM(Latitude),3))};var DENOM=function(Latitude){return(Sqr2(1.e0-TranMerc_es*Math.pow(Math.sin(Latitude),2)))};var SetTransMercParams=function(OriginLatitude,CentralMeridian,FalseEasting,FalseNorthing,ScaleFactor){OriginLatitude=OriginLatitude*RAD_PER_DEG;CentralMeridian=CentralMeridian*RAD_PER_DEG;TranMerc_Origin_Lat=OriginLatitude;if(CentralMeridian>Pi)CentralMeridian=CentralMeridian-Pi*2;TranMerc_Origin_Long=CentralMeridian;TranMerc_False_Northing=FalseNorthing;TranMerc_False_Easting=FalseEasting;TranMerc_Scale_Factor=ScaleFactor};var Lat_Long_to_East_North=function(Latitude,Longitude){var c,c2,c3,c5,c7,dlam,eta,eta2,eta3,eta4,s,sn,t,tan2,tan3,tan4,tan5,tan6,t1,t2,t3,t4,t5,t6,t7,t8,t9,tmd,tmdo,temp_Origin,temp_Long;Latitude=Latitude*RAD_PER_DEG;Longitude=Longitude*RAD_PER_DEG;if(Longitude>Pi)Longitude=Longitude-Pi*2;if((Longitude<(TranMerc_Origin_Long-MAX_DELTA_LONG))||(Longitude>(TranMerc_Origin_Long+MAX_DELTA_LONG))){if(Longitude<0)temp_Long=Longitude+Pi*2;else temp_Long=Longitude;if(TranMerc_Origin_Long<0)temp_Origin=TranMerc_Origin_Long+Pi*2;else temp_Origin=TranMerc_Origin_Long}dlam=Longitude-TranMerc_Origin_Long;if(dlam>Pi)dlam=dlam-Pi*2;if(dlam< -Pi)dlam=dlam+Pi*2;if(Math.abs(dlam)<2.e-10)dlam=0.0;s=Math.sin(Latitude);c=Math.cos(Latitude);c2=c*c;c3=c2*c;c5=c3*c2;c7=c5*c2;t=Math.tan(Latitude);tan2=t*t;tan3=tan2*t;tan4=tan3*t;tan5=tan4*t;tan6=tan5*t;eta=TranMerc_ebs*c2;eta2=eta*eta;eta3=eta2*eta;eta4=eta3*eta;sn=SPHSN(Latitude);tmd=SPHTMD(Latitude);tmdo=SPHTMD(TranMerc_Origin_Lat);t1=(tmd-tmdo)*TranMerc_Scale_Factor;t2=sn*s*c*TranMerc_Scale_Factor/2.e0;t3=sn*s*c3*TranMerc_Scale_Factor*(5.e0-tan2+9.e0*eta+4.e0*eta2)/24.e0;t4=sn*s*c5*TranMerc_Scale_Factor*(61.e0-58.e0*tan2+tan4+270.e0*eta-330.e0*tan2*eta+445.e0*eta2+324.e0*eta3-680.e0*tan2*eta2+88.e0*eta4-600.e0*tan2*eta3-192.e0*tan2*eta4)/720.e0;t5=sn*s*c7*TranMerc_Scale_Factor*(1385.e0-3111.e0*tan2+543.e0*tan4-tan6)/40320.e0;Northing=TranMerc_False_Northing+t1+Math.pow(dlam,2.e0)*t2+Math.pow(dlam,4.e0)*t3+Math.pow(dlam,6.e0)*t4+Math.pow(dlam,8.e0)*t5;Northing=Northing* -1;t6=sn*c*TranMerc_Scale_Factor;t7=sn*c3*TranMerc_Scale_Factor*(1.e0-tan2+eta)/6.e0;t8=sn*c5*TranMerc_Scale_Factor*(5.e0-18.e0*tan2+tan4+14.e0*eta-58.e0*tan2*eta+13.e0*eta2+4.e0*eta3-64.e0*tan2*eta2-24.e0*tan2*eta3)/120.e0;t9=sn*c7*TranMerc_Scale_Factor*(61.e0-479.e0*tan2+179.e0*tan4-tan6)/5040.e0;Easting=TranMerc_False_Easting+dlam*t6+Math.pow(dlam,3.e0)*t7+Math.pow(dlam,5.e0)*t8+Math.pow(dlam,7.e0)*t9;var pos={horzPos:0,vertPos:0};pos.horzPos=Math.round(Easting);pos.vertPos=Math.round(Northing);return pos;};t.LTLGtoITM=function(Lat,Lng){SetTransMercParams(31.734393,35.204516,219529.584,626907.390,1.0000067);return Lat_Long_to_East_North(Lat,Lng)};t.ITMtoLTLG=function(East,North){return East_North_to_Lat_Long(Math.round(East),Math.round(-1*North),6378137.000,6356752.313,219529.584,626907.3899999999,1.0000067,31.73439361,35.20451694)};t.MercatorToITM=function(East,North){East=East/100000;North=North/ -100000;North=(2*Math.atan(Math.exp(North*Math.PI/180))-Math.PI/2)*180/Math.PI;SetTransMercParams(31.734393,35.204516,219529.584,626907.390,1.0000067);return Lat_Long_to_East_North(North,East)};t.ITMToMercator=function(East,North){pos=East_North_to_Lat_Long(Math.round(East),Math.round(-1*North),6378137.000,6356752.313,219529.584,626907.3899999999,1.0000067,31.73439361,35.20451694);d=Math.min(0.99999999,Math.max(-0.99999999,Math.sin((pos.vertPos)*Math.PI/180)));pos.vertPos=(0.5*Math.log((1+d)/(1-d))*180/Math.PI);pos.vertPos=pos.vertPos*100000;pos.horzPos=pos.horzPos*100000;return pos};};gIStools=new GIStools();;;function GIStools(){var t=this;var Sqr=function(x){return Math.pow(x,0.5);};var Marc=function(bf0,n,PHI0,PHI){n2=n*n;return bf0*(((1+n+((5/4)*(n2))+((5/4)*(n2*n)))*(PHI-PHI0))-(((3*n)+(3*(n2))+((21/8)*(n2*n)))*(Math.sin(PHI-PHI0))*(Math.cos(PHI+PHI0)))+((((15/8)*(n2))+((15/8)*(n2*n)))*(Math.sin(2*(PHI-PHI0)))*(Math.cos(2*(PHI+PHI0))))-(((35/24)*(n2*n))*(Math.sin(3*(PHI-PHI0)))*(Math.cos(3*(PHI+PHI0)))))};var InitialLat=function(North,n0,afo,PHI0,n,bfo){PHI1=((North-n0)/afo)+PHI0;M=Marc(bfo,n,PHI0,PHI1);PHI2=((North-n0-M)/afo)+PHI1;while(Math.abs(North-n0-M)>0.000000001){PHI2=((North-n0-M)/afo)+PHI1;M=Marc(bfo,n,PHI0,PHI2);PHI1=PHI2;}return PHI2;};var East_North_to_Lat_Long=function(East,North,a,b,e0,n0,f0,PHI0,LAM0){Pi=4*Math.atan(1);RadPHI0=PHI0*(Pi/180);RadLAM0=LAM0*(Pi/180);af0=a*f0;bf0=b*f0;af02=af0*af0;bf02=bf0*bf0;e2=((af02)-(bf02))/(af02);n=(af0-bf0)/(af0+bf0);Et=East-e0;Et2=Et*Et;PHId=InitialLat(North,n0,af0,RadPHI0,n,bf0);SinPHId2=Math.sin(PHId)*Math.sin(PHId);nu=af0/(Sqr(1-(e2*(SinPHId2))));nu2=nu*nu;rho=(nu*(1-e2))/(1-(e2*SinPHId2));eta2=(nu/rho)-1;TanPHId=Math.tan(PHId);TanPHId2=TanPHId*TanPHId;VII=(Math.tan(PHId))/(2*rho*nu);VIII=((Math.tan(PHId))/(24*rho*(nu2*nu)))*(5+(3*(TanPHId2))+eta2-(9*eta2*(TanPHId2)));IX=((Math.tan(PHId))/(720*rho*(nu2*nu2*nu)))*(61+(90*(TanPHId2))+(45*(TanPHId2*TanPHId2)));X=(1/Math.cos(PHId))/nu;XI=((1/Math.cos(PHId))/(6*(nu2*nu)))*((nu/rho)+(2*(TanPHId2)));XII=((1/Math.cos(PHId))/(120*(nu2*nu*nu2)))*(5+(28*(TanPHId2))+(24*(TanPHId2*TanPHId2)));XIIA=((1/Math.cos(PHId))/(5040*(nu2*nu*nu2*nu2)))*(61+(662*(TanPHId2))+(1320*(TanPHId2*TanPHId2))+(720*(TanPHId2*TanPHId2*TanPHId2)));var point={vertPos:0,horzPos:0};point.horzPos=(180/Pi)*(RadLAM0+(Et*X)-((Et2*Et)*XI)+((Et2*Et2*Et)*XII)-((Et2*Et2*Et2*Et)*XIIA));point.vertPos=(180/Pi)*(PHId-((Et2)*VII)+((Et2*Et2)*VIII)-((Et2*Et2*Et2)*IX));return point;};var TranMerc_Origin_Lat,TranMerc_Origin_Long,TranMerc_False_Northing,TranMerc_False_Easting,TranMerc_Scale_Factor,RAD_PER_DEG,Pi;PI=Math.PI;RAD_PER_DEG=PI/180.0;var MAX_LAT=((PI*90.0)/180.0);var MAX_DELTA_LONG=((PI*90.0)/180.0);var MIN_SCALE_FACTOR=0.3;var MAX_SCALE_FACTOR=3.0;var TranMerc_a=6378137.0;var TranMerc_f=1/298.257223563;var TranMerc_es=0.0066943799901413800;var TranMerc_ebs=0.0067394967565869;var TranMerc_ap=6367449.1458008;var TranMerc_bp=16038.508696861;var TranMerc_cp=16.832613334334;var TranMerc_dp=0.021984404273757;var TranMerc_ep=3.1148371319283e-005;var TranMerc_Delta_Easting=40000000.0;var TranMerc_Delta_Northing=40000000.0;var Sqr2=function(x){return Math.pow(x,0.5);};var SPHTMD=function(Latitude){return(TranMerc_ap*Latitude-TranMerc_bp*Math.sin(2.e0*Latitude)+TranMerc_cp*Math.sin(4.e0*Latitude)-TranMerc_dp*Math.sin(6.e0*Latitude)+TranMerc_ep*Math.sin(8.e0*Latitude))};var SPHSN=function(Latitude){return(TranMerc_a/Sqr2(1.e0-TranMerc_es*Math.pow(Math.sin(Latitude),2)))};var SPHSR=function(Latitude){return(TranMerc_a*(1.e0-TranMerc_es)/Math.pow(DENOM(Latitude),3))};var DENOM=function(Latitude){return(Sqr2(1.e0-TranMerc_es*Math.pow(Math.sin(Latitude),2)))};var SetTransMercParams=function(OriginLatitude,CentralMeridian,FalseEasting,FalseNorthing,ScaleFactor){OriginLatitude=OriginLatitude*RAD_PER_DEG;CentralMeridian=CentralMeridian*RAD_PER_DEG;TranMerc_Origin_Lat=OriginLatitude;if(CentralMeridian>Pi)CentralMeridian=CentralMeridian-Pi*2;TranMerc_Origin_Long=CentralMeridian;TranMerc_False_Northing=FalseNorthing;TranMerc_False_Easting=FalseEasting;TranMerc_Scale_Factor=ScaleFactor};var Lat_Long_to_East_North=function(Latitude,Longitude){var c,c2,c3,c5,c7,dlam,eta,eta2,eta3,eta4,s,sn,t,tan2,tan3,tan4,tan5,tan6,t1,t2,t3,t4,t5,t6,t7,t8,t9,tmd,tmdo,temp_Origin,temp_Long;Latitude=Latitude*RAD_PER_DEG;Longitude=Longitude*RAD_PER_DEG;if(Longitude>Pi)Longitude=Longitude-Pi*2;if((Longitude<(TranMerc_Origin_Long-MAX_DELTA_LONG))||(Longitude>(TranMerc_Origin_Long+MAX_DELTA_LONG))){if(Longitude<0)temp_Long=Longitude+Pi*2;else temp_Long=Longitude;if(TranMerc_Origin_Long<0)temp_Origin=TranMerc_Origin_Long+Pi*2;else temp_Origin=TranMerc_Origin_Long}dlam=Longitude-TranMerc_Origin_Long;if(dlam>Pi)dlam=dlam-Pi*2;if(dlam< -Pi)dlam=dlam+Pi*2;if(Math.abs(dlam)<2.e-10)dlam=0.0;s=Math.sin(Latitude);c=Math.cos(Latitude);c2=c*c;c3=c2*c;c5=c3*c2;c7=c5*c2;t=Math.tan(Latitude);tan2=t*t;tan3=tan2*t;tan4=tan3*t;tan5=tan4*t;tan6=tan5*t;eta=TranMerc_ebs*c2;eta2=eta*eta;eta3=eta2*eta;eta4=eta3*eta;sn=SPHSN(Latitude);tmd=SPHTMD(Latitude);tmdo=SPHTMD(TranMerc_Origin_Lat);t1=(tmd-tmdo)*TranMerc_Scale_Factor;t2=sn*s*c*TranMerc_Scale_Factor/2.e0;t3=sn*s*c3*TranMerc_Scale_Factor*(5.e0-tan2+9.e0*eta+4.e0*eta2)/24.e0;t4=sn*s*c5*TranMerc_Scale_Factor*(61.e0-58.e0*tan2+tan4+270.e0*eta-330.e0*tan2*eta+445.e0*eta2+324.e0*eta3-680.e0*tan2*eta2+88.e0*eta4-600.e0*tan2*eta3-192.e0*tan2*eta4)/720.e0;t5=sn*s*c7*TranMerc_Scale_Factor*(1385.e0-3111.e0*tan2+543.e0*tan4-tan6)/40320.e0;Northing=TranMerc_False_Northing+t1+Math.pow(dlam,2.e0)*t2+Math.pow(dlam,4.e0)*t3+Math.pow(dlam,6.e0)*t4+Math.pow(dlam,8.e0)*t5;Northing=Northing* -1;t6=sn*c*TranMerc_Scale_Factor;t7=sn*c3*TranMerc_Scale_Factor*(1.e0-tan2+eta)/6.e0;t8=sn*c5*TranMerc_Scale_Factor*(5.e0-18.e0*tan2+tan4+14.e0*eta-58.e0*tan2*eta+13.e0*eta2+4.e0*eta3-64.e0*tan2*eta2-24.e0*tan2*eta3)/120.e0;t9=sn*c7*TranMerc_Scale_Factor*(61.e0-479.e0*tan2+179.e0*tan4-tan6)/5040.e0;Easting=TranMerc_False_Easting+dlam*t6+Math.pow(dlam,3.e0)*t7+Math.pow(dlam,5.e0)*t8+Math.pow(dlam,7.e0)*t9;var pos={horzPos:0,vertPos:0};pos.horzPos=Math.round(Easting);pos.vertPos=Math.round(Northing);return pos;};t.LTLGtoITM=function(Lat,Lng){SetTransMercParams(31.734393,35.204516,219529.584,626907.390,1.0000067);return Lat_Long_to_East_North(Lat,Lng)};t.LTLGtoITMMapa=function(Lat,Lng){SetTransMercParams(31.7347605757,35.20520781886,219529.584,626907.390,1.00001233);return Lat_Long_to_East_North(Lat,Lng)};t.ITMtoLTLG=function(East,North){return East_North_to_Lat_Long(Math.round(East),Math.round(-1*North),6378137.000,6356752.313,219529.584,626907.3899999999,1.0000067,31.73439361,35.20451694)};t.ITMMapaToLTLG=function(East,North){return East_North_to_Lat_Long(Math.round(East),Math.round(-1*North),6378137.000,6356752.313,219529.584,626907.3899999999,1.00001233,31.7347605757,35.20520781886)};t.MercatorToITM=function(East,North){East=East/100000;North=North/ -100000;North=(2*Math.atan(Math.exp(North*Math.PI/180))-Math.PI/2)*180/Math.PI;SetTransMercParams(31.734393,35.204516,219529.584,626907.390,1.0000067);return Lat_Long_to_East_North(North,East)};t.ITMToMercator=function(East,North){pos=East_North_to_Lat_Long(Math.round(East),Math.round(-1*North),6378137.000,6356752.313,219529.584,626907.3899999999,1.0000067,31.73439361,35.20451694);d=Math.min(0.99999999,Math.max(-0.99999999,Math.sin((pos.vertPos)*Math.PI/180)));pos.vertPos=(0.5*Math.log((1+d)/(1-d))*180/Math.PI);pos.vertPos=pos.vertPos*100000;pos.horzPos=pos.horzPos*100000;return pos};};gIStools=new GIStools();function Address(_houseNumber,_street,_city,_state,_zipCode,_country,_fullAddress,_coordinate,_zoomLevel,_zPos,_theName,_theDescription,_statusCode,_statusDescription,_hrefIcon,_boundingBox,_minZoomLevel,_maxZoomLevel,_adminAreasStr,_simpleDataStr,_countryCode){if(arguments.length>1){this.houseNumber=_houseNumber;this.street=_street;this.city=_city;this.state=_state;this.zipCode=_zipCode;this.country=_country;this.fullAddress=_fullAddress;this.coordinate=_coordinate;this.zoomLevel=_zoomLevel;this.language="";if(arguments.length>10){this.zPos=_zPos;this.name=_theName;this.description=_theDescription;this.statusCode=_statusCode;this.statusDescription=_statusDescription;this.hrefIcon=_hrefIcon;this.boundingBox=_boundingBox;this.minZoomLevel=_minZoomLevel;this.maxZoomLevel=_maxZoomLevel;this.countryCode=_countryCode;if((_adminAreasStr!=null)&&(_adminAreasStr!="")){adminAreasStrArgs=_adminAreasStr.split("~");if(adminAreasStrArgs.length-1==0)this.adminAreas=null;else{this.adminAreas=new Array(adminAreasStrArgs.length-1);for(j=0;j<adminAreasStrArgs.length;j++){adminAreaStrArgs=adminAreasStrArgs[j].split("|");this.adminAreas[j]=new AdminArea(adminAreaStrArgs[0],adminAreaStrArgs[1],adminAreaStrArgs[2],adminAreaStrArgs[3]);}}}else this.adminAreas=null;if((_simpleDataStr!=null)&&(_simpleDataStr!="")){simpleDataStrArgs=_simpleDataStr.split("~");if(simpleDataStrArgs.length-1==0)this.simpleData=null;else{this.simpleData=new Array(simpleDataStrArgs.length-1);for(j=0;j<simpleDataStrArgs.length;j++){simpleDataValueStrArgs=simpleDataStrArgs[j].split("|");this.simpleData[j]=new SimpleData(simpleDataValueStrArgs[0],simpleDataValueStrArgs[1]);}}}else this.simpleData=null;if(arguments.length>21){this.fullTerm=arguments[21];this.whatText=arguments[22];this.categoryList=arguments[23];this.where=arguments[24];}}}else{this.fullAddress=arguments[0]}this.type="address";this.toString=function(){return "address"}};function SearchRequest(_searchTerms,_addressOrCoordinate,_address,_settingsRequest){this.searchTerms=_searchTerms;if((_addressOrCoordinate!=null)&&(_addressOrCoordinate!="")){if(_addressOrCoordinate.type=="address"){this.address=_addressOrCoordinate;this.coordinate=null}else{this.coordinate=_addressOrCoordinate;if(_address!=null)this.address=_address;else this.address=null;}}else{this.coordinate=null;if(_address!=null)this.address=_address;else this.address=null;}this.poiCategories="";this.countryCode=clientSettings.defaultCountryCode;this.language=clientSettings.defaultLanguage;this.resultsLimit="";this.maxRadius="";this.minGrade="";if(arguments.length>3){if(_settingsRequest.poiCategories!="")this.poiCategories=_settingsRequest.poiCategories;if(_settingsRequest.countryCode!="")this.countryCode=_settingsRequest.countryCode;if(_settingsRequest.language!="")this.language=_settingsRequest.language;if(_settingsRequest.resultsLimit!="")this.resultsLimit=_settingsRequest.resultsLimit;if(_settingsRequest.maxRadius!="")this.maxRadius=_settingsRequest.maxRadius;if(_settingsRequest.minGrade!="")this.minGrade=_settingsRequest.minGrade;}this.type="searchrequest";this.toString=function(){return "searchrequest"}};function SettingsRequest(_countryCode,_language,_resultsLimit,_poiCategories,_maxRadius,_minGrade,_addressId,_addressTypeId){this.countryCode=clientSettings.defaultCountryCode;if((_countryCode!=null)&&(_countryCode!="")&&(_countryCode.toLowerCase()!="wrd"))this.countryCode=_countryCode;else if(_countryCode.toLowerCase()=="wrd")this.countryCode="";this.language="";if((_language!=null)&&(_language!=""))this.language=_language;this.resultsLimit="";if((_resultsLimit!=null)&&(_resultsLimit!=""))this.resultsLimit=_resultsLimit;this.minGrade="";if((_minGrade!=null)&&(_minGrade!=""))this.minGrade=_minGrade;this.poiCategories="";if((_poiCategories!=null)&&(_poiCategories!=""))this.poiCategories=_poiCategories;this.maxRadius="";if((_maxRadius!=null)&&(_maxRadius!=""))this.maxRadius=_maxRadius;this.addressId="";if((_addressId!=null)&&(_addressId!=""))this.addressId=_addressId;this.addressTypeId="";if((_addressTypeId!=null)&&(_addressTypeId!=""))this.addressTypeId=_addressTypeId;this.type="settingsrequest";this.toString=function(){return "settingsrequest"}};function Placemark(_name,_address,_description,_hrefIcon,_boundingBox,_coordinate,_zPos,_phoneNumber,_categoryName,_categoryId,_minZoomLevel,_maxZoomLevel){this.name=_name;this.address=_address;this.description=_description;this.hrefIcon=_hrefIcon;this.boundingBox=_boundingBox;this.coordinate=_coordinate;this.zPos=_zPos;if(arguments.length>6)this.phoneNumber=_phoneNumber;if(arguments.length>7)this.categoryName=_categoryName;if(arguments.length>8)this.categoryId=_categoryId;if(arguments.length>9)this.minZoomLevel=_minZoomLevel;if(arguments.length>10)this.maxZoomLevel=_maxZoomLevel;this.type="placemark";this.toString=function(){return "placemark"}};function AdminArea(_localName,_likeName,_displayFlag,_value){this.localName=_localName;this.likeName=_likeName;this.displayFlag=_displayFlag;this.value=_value;this.type="adminarea";this.toString=function(){return "adminarea"}};function SimpleData(_Name,_Value){this.name=_Name;this.value=_Value;this.type="simpledata";this.toString=function(){return "simpledata"}};function GeoIP(_ip,_lat,_long,_zoomLevel,_countryCode,_countryName,_region,_city,_postalCode,_areaCode){this.ip=_ip;this.coordinate=new LatLong(_lat,_long);this.zoomLevel=_zoomLevel;this.countryCode=_countryCode;this.countryName=_countryName;this.region=_region;this.city=_city;this.postalCode=_postalCode;this.areaCode=_areaCode;this.type="geoip";this.toString=function(){return "geoip";}};function ScreenCoordinate(_x,_y){this.x=_x;this.y=_y;this.toString=function(){return "screenCoordinate"}};ScreenPoint=ScreenCoordinate;;function MapSize(_width,_height){this.width=_width;this.height=_height;this.toString=function(){return "mapSize"}};function MapBounds(_topLeft,_bottomRight){this.topLeft=_topLeft;this.bottomRight=_bottomRight;this.toString=function(){return "mapBounds"}};Bounds=MapBounds;;function Maneuver(_description,_location,_type,_direction,_road,_length,_coordinatesList,_coordinatesString,_name,_fullAddress,_simpleDataStr,_hrefIcon,_styleUrl,_timeInfo,_distance){this.description=_description;this.location=_location;this.type=_type;this.direction=_direction;this.road=_road;this.length=_length;this.coordinatesList=_coordinatesList;this.coordinatesString=_coordinatesString;if(arguments.length>9){this.name=_name;this.fullAddress=_fullAddress;simpleDataStrArgs=_simpleDataStr.split("~");if(simpleDataStrArgs.length-1==0)this.simpleData=null;else{this.simpleData=new Array(simpleDataStrArgs.length-1);for(j=0;j<simpleDataStrArgs.length;j++){simpleDataValueStrArgs=simpleDataStrArgs[j].split("|");this.simpleData[j]=new SimpleData(simpleDataValueStrArgs[0],simpleDataValueStrArgs[1]);}}this.hrefIcon=_hrefIcon;this.styleUrl=_styleUrl;this.timeInfo=_timeInfo;this.distance=_distance;}this.toString=function(){return "maneuver"}};function BrushStyle(_color,_alpha){this.color=_color;this.alpha=_alpha;this.toString=function(){return "brushStyle"}};function LineStyle(_width,_color,_alpha){this.width=_width;this.color=_color;this.alpha=_alpha;this.toString=function(){return "lineStyle"}};function MarkerRecord(_shapeId,_x,_y,_icon,_label,_hint,_visible,_labelVisible,_direction,_attributesList){if(_visible==null)_visible=true;if(_labelVisible==null)_labelVisible=true;this.shapeType=Shape.MARKER;this.shapeId=_shapeId;this.x=_x;this.y=_y;this.icon=_icon;this.label=_label;this.hint=_hint;this.visible=_visible;this.labelVisible=_labelVisible;this.direction=_direction;this.attributesList=_attributesList;this.tileId=null;this.tileIndex=null;this.parentsArrPos=null};function PolyRecord(_type,_shapeId,_verticesString,_lineStyle,_brushStyle,_label,_hint,_visible,_labelVisible,_attributesList){if(_visible==null)_visible=true;if(_labelVisible==null)_labelVisible=true;this.shapeType=_type;this.shapeId=_shapeId;this.verticesString=_verticesString;this.lineStyle=_lineStyle;this.brushStyle=_brushStyle;this.label=_label;this.hint=_hint;this.visible=_visible;this.labelVisible=_labelVisible;this.attributesList=_attributesList;this.tileId=null;this.tileIndex=null;this.parentsArrPos=null};function CircleRecord(_shapeId,_coordinateString,_lineStyle,_brushStyle,_label,_hint,_visible,_labelVisible,_attributesList){if(_visible==null)_visible=true;if(_labelVisible==null)_labelVisible=true;this.shapeType=Shape.CIRCLE;this.shapeId=_shapeId;this.coordinateString=_coordinateString;this.lineStyle=_lineStyle;this.brushStyle=_brushStyle;this.label=_label;this.hint=_hint;this.visible=_visible;this.labelVisible=_labelVisible;this.attributesList=_attributesList;this.tileId=null;this.tileIndex=null;this.parentsArrPos=null};function Flash(){var t=this;var args="";var commandsQueue=new Array();t.allowRunFunction=true;t.init=function(_id,_width,_height,_src,_bgColor,_transparent,_parentObjectId){t.id=_id;t.width=_width;t.height=_height;t.src=_src;t.bgColor=_bgColor;t.transparent=_transparent;t.version="6,0,0,0";t.parentObjectId=_parentObjectId};t.getHtmlFlashTag=function(){if(t.transparent)t.transparent="transparent";else t.transparent="";if(t.bgColor==null)t.bgColor="FFFFFF";if(t.parentObjectId!=null){onMouseOutEventString='onmouseout=flashListener.triggerEvent("'+t.parentObjectId+'","'+Flash.EVENT_FLASH_MOUSE_OUT+'","")'}else onMouseOutEventString='';var flashHtml="";t.width+="";t.height+="";var divWidth=t.width.replace("%25","%");var divHeight=t.height.replace("%25","%");if(divWidth.indexOf("%")== -1)divWidth+="px";if(divHeight.indexOf("%")== -1)divHeight+="px";flashHtml+='<div id="Div'+t.id+'" '+onMouseOutEventString+' xonmouseover="document.focus();" style="position:relative; overflow-x:hidden;overflow-y:hidden;width:'+divWidth+';height:'+divHeight+';background-color:#'+t.bgColor+'">';flashHtml+='<O';flashHtml+='BJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';flashHtml+=' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+t.version+'"';flashHtml+=' WIDTH="'+t.width+'" HEIGHT="'+t.height+'" id="'+t.id+'" ALIGN=""';if(navigator.userAgent.toLowerCase().indexOf('chrome')> -1)flashHtml+=' name="'+t.id+'">';else flashHtml+='>';flashHtml+=' <PARAM NAME=movie VALUE=';flashHtml+='"'+t.src+'"> <PARAM NAME=zmenu VALUE=false> <PARAM NAME=FlashVars VALUE="'+args+'"> <PARAM NAME=bgcolor VALUE="#'+t.bgColor+'"> <PARAM NAME=quality VALUE=high> <PARAM name="allowScriptAccess" value="always"> <PARAM NAME=wmode VALUE="'+t.transparent+'"> ';flashHtml+='<E';flashHtml+='MBED src="'+t.src+'" quality=high wmode="'+t.transparent+'" allowScriptAccess="always" FlashVars="'+args+'" bgcolor="#'+t.bgColor+'" Menu=true WIDTH="'+t.width+'" HEIGHT="'+t.height+'" NAME="'+t.id+'" ALIGN=""';flashHtml+=' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></E';flashHtml+='MBED>';flashHtml+='</O';flashHtml+='BJECT>';flashHtml+='</div>';var IEflashFsCommand="";if(is_internet_explorer())IEflashFsCommand='<script event=FSCommand(command,args) for='+t.id+'>Flash_DoFSCommand(document.'+t.id+',command, args);</script>';var MozillaflashFsCommand='<script type="text/javascript">function '+t.id+'_DoFSCommand(command,args) {Flash_DoFSCommand(document.'+t.id+',command, args);}</script>';if(navigator.userAgent.toLowerCase().indexOf('chrome')> -1){var node=document.getElementsByTagName("head")[0]||document.body;if(node){var script=document.createElement("script");script.type="text/javascript";script.innerHTML='function '+t.id+'_DoFSCommand(command,args) {Flash_DoFSCommand(document.'+t.id+',command, args);}';node.appendChild(script);}}flashHtml+=IEflashFsCommand+MozillaflashFsCommand;return flashHtml};t.writeFlash=function(){var d=document;d.write(t.getHtmlFlashTag());t.object=eval("d."+t.id);if(t.parentObjectId!=null){if(!is_internet_explorer()){if(navigator.userAgent.toLowerCase().indexOf('chrome')> -1){div=document.getElementById(t.id);div.addEventListener('mousewheel',t.onMouseWheel,false);}else if(navigator.userAgent.toLowerCase().indexOf('firefox')> -1)t.object.addEventListener('DOMMouseScroll',t.onMouseWheel,false);else{div=document.getElementById(t.id);div.addEventListener('mousewheel',t.onMouseWheel,false);}}else{t.object.attachEvent("onmousewheel",t.onMouseWheel);}}};t.writeFlashTo=function(div){div.innerHTML=t.getHtmlFlashTag();t.object=eval("document."+t.id);if(t.parentObjectId!=null){if(!is_internet_explorer()){if(navigator.userAgent.toLowerCase().indexOf('firefox')> -1)t.object.addEventListener('DOMMouseScroll',t.onMouseWheel,false);else{div.addEventListener('mousewheel',t.onMouseWheel,false);}}else{t.object.attachEvent("onmousewheel",t.onMouseWheel);}}if(!is_internet_explorer()){var oScript=document.createElement("script");oScript.innerHTML='function '+t.id+'_DoFSCommand(command,args) {Flash_DoFSCommand(document.'+t.id+',command, args);}';document.body.appendChild(oScript);}};t.onMouseWheel=function(evt){var delta;if((!is_internet_explorer())&& !(navigator.userAgent.toLowerCase().indexOf('chrome')> -1)&& !(navigator.userAgent.toLowerCase().indexOf('safari')> -1)){delta= -1*evt.detail;if(evt.preventDefault)evt.preventDefault();}else{delta=event.wheelDelta;event.returnValue=false;}flashListener.triggerEvent(t.parentObjectId,Flash.EVENT_FLASH_MOUSE_WHEEL,new Array(""+delta))};t.getContainer=function(name,value){return document.getElementById("Div"+t.id)};t.addArg=function(name,value){args+=name+"="+value+"&"};t.runFunction=function(){try{var i;if(arguments.length>1){if((t.allowRunFunction)||(arguments[1].toLowerCase()=="initializemap")){t.object.SetVariable("JSArg0",arguments[1]);if(arguments.length>2){for(i=1;i<arguments.length-1;i++){t.object.SetVariable("JSArg"+i,arguments[i+1]);}}t.object.SetVariable("JSArguments",arguments.length-2);if(arguments[0]=="")arguments[0]="/";t.object.TCallLabel(arguments[0],"runFunction");}else{addCommandToQueue(arguments[0],t.runFunction,arguments)}}}catch(ex){addCommandToQueue(arguments[0],t.runFunction,arguments)}};t.getVariable=function(arg){try{return t.object.GetVariable(arg);}catch(ex){addCommandToQueue(t.getVariable,arguments);return null}};t.setVariable=function(arg,value){try{t.object.SetVariable("/:"+arg,value);}catch(ex){addCommandToQueue(t.setVariable,arguments)}};var addCommandToQueue=function(level,fun,arg){if(commandsQueue[level]==null)commandsQueue[level]=new Array();var arr=commandsQueue[level];arr.push(fun);arr.push(arg)};t.doCommandsQueue=function(level){var i;if(commandsQueue[level]==null)commandsQueue[level]=new Array();var arr=commandsQueue[level];for(i=0;i<arr.length;i=i+2){fun=arr[i];arg=arr[i+1];fun.apply(this,arg)}commandsQueue[level]==null}};function Flash_DoFSCommand(flash,id_evt,args){var splitId_Evt=id_evt.split("^");objectId=splitId_Evt[0];evt=splitId_Evt[1];var i;flashListener.triggerEvent(objectId,evt,args);};Flash.EVENT_FLASH_INITIALIZE="onflashinitialize";Flash.EVENT_FLASH_MOUSE_OUT="onflashmouseout";Flash.EVENT_FLASH_MOUSE_WHEEL="onflashmousewheel";AutoSuggest.id=0;autoSuggestFlash=null;autoSuggestFlashId="AutoSuggestFlash";_publicChangeColor=null;_publicSetACFieldValue=null;_publicSetACFieldMouseOver=null;autoSuggestIntervalObject=null;autoSuggestIntervalId=null;function autoSuggestInterval(nKeyCode){window.clearInterval(autoSuggestIntervalId);autoSuggestIntervalId=null;autoSuggestIntervalObject.getACOuternal(nKeyCode)};function ASWindowLoaded(){var newTarget=document.createElement("div");newTarget.id="Div"+holdFlashObjectsArrCount;newTarget.style.position="absolute";newTarget.style.top="0px";newTarget.style.left="0px";newTarget.style.width="1px";newTarget.style.height="1px";newTarget.style.overflow="hidden";newTarget.innerHTML=autoSuggestFlash.getHtmlFlashTag();document.body.appendChild(newTarget);autoSuggestFlash.object=eval("document."+autoSuggestFlashId)};function initFlash(){if(autoSuggestFlash==null){autoSuggestFlash=new Flash();var c=clientSettings;autoSuggestFlash.init(autoSuggestFlashId,1,1,c.autoSuggestSwfSource,"",true);autoSuggestFlash.addArg("FlashId","_AS_");autoSuggestFlash.addArg("UD",c.UD);autoSuggestFlash.addArg("SessionId",c.sessionId);autoSuggestFlash.addArg("MapVersion",c.mapVer);if(document.addEventListener){document.addEventListener("DOMContentLoaded",ASWindowLoaded,null);}else{window.attachEvent('onload',ASWindowLoaded)}}};function loadAutoSuggest(){initFlash();};function AutoSuggest(){var t=this;var id=AutoSuggest.id;AutoSuggest.id++;var xmlHttp=null;var rowSelectedId=null;var lastKeyCodePressed=null;var ACResultsLength=0;var lastDivInnerHTML="";var fontFamily="Arial";var fontSize="12";var fontColor="#000000";var ACBorderColor="#65AAEF";var ACBorderWidth="1";var ACBackgroundColor="#FFFFFF";var offsetTop=2;var offsetLeft= -1;var offsetWidth=2;var offsetHeight=0;if(atGuiLang.toLowerCase()=="heb"){var ACDirection="rtl";var alignment="right"}else{var ACDirection="ltr";var alignment="left"}var numOfResults=10;var autoResultsFit=false;var _SettingsRequest=new SettingsRequest("","","","","","");var _zipCode=null;var textBoxArr=new Array();textBoxArr[0]=arguments[0];textBoxArr[1]=null;if(arguments.length>=1){textBoxCount=1;for(i=1;i<arguments.length;i++){if(arguments[i].type=="settingsrequest"){_SettingsRequest=arguments[i];}else{textBoxArr[textBoxCount]=arguments[i];textBoxCount++;}}}t.resultList=null;initFlash();t.flashCallBackEvent=function(evt,args){switch(evt){case Flash.EVENT_FLASH_INITIALIZE:break;case AutoSuggest.EVENT_AUTO_SUGGEST_RESULT:if(args!=""){argsSplit=args.split("^");var argsArr=new Array();for(var i=0;i<argsSplit.length;i++){argsArr.push(argsSplit[i])}setACResults.apply(this,argsArr);}else{frm.style.display='none';mainDiv.style.display='none'}return new Array(t);break;}};flashListener.addListener("_AS_"+id,t.flashCallBackEvent,Flash.EVENT_FLASH_INITIALIZE);flashListener.addListener("_AS_"+id,t.flashCallBackEvent,AutoSuggest.EVENT_AUTO_SUGGEST_RESULT);textBoxArr[0].setAttribute("autocomplete","off");textBoxArr[0].style.direction=ACDirection;t.onTextBoxBlur=function(){t.closeACList();};if(textBoxArr[0].addEventListener){textBoxArr[0].addEventListener("blur",t.onTextBoxBlur,null);}else{textBoxArr[0].attachEvent('onblur',t.onTextBoxBlur)}var newDiv=document.createElement("div");newDiv.id="ACContainerDiv"+id;newDiv.style.position="absolute";newDiv.style.zindex="1050";newDiv.innerHTML='<iframe Id="FrmAC'+id+'" src="about:blank" scrolling="no" frameborder="0" style="position:absolute;height:0px;top:-1px;left:0px;border:none;display:none;z-index: 0"></iframe>';newDiv.innerHTML+='<Div Id="DivAC'+id+'" style="direction:rtl; overflow-y: hidden; overflow-x: hidden;border-left:'+ACBorderWidth+'px solid '+ACBorderColor+';border-bottom:'+ACBorderWidth+'px solid '+ACBorderColor+';border-right:'+ACBorderWidth+'px solid '+ACBorderColor+';position:absolute;top:-1px;left:0px;Height:0px;width:100%;display:none;Background-color:'+ACBackgroundColor+';"></Div>';document.body.appendChild(newDiv);var containerDiv=document.getElementById("ACContainerDiv"+id);var frm=document.getElementById('FrmAC'+id);var mainDiv=document.getElementById('DivAC'+id);t.getTextBox=function(){return textBoxArr[0];};t.getTextBoxEx=function(){return textBoxArr[1];};t.isSuggestListOpen=function(){if(mainDiv.style.display==''){return true;}else{return false;}};var checkKeyCode=function(keyCode){if(keyCode==8){return false;}else{return true;}};var getKeyCode=function(ev){if(ev){return ev.keyCode;}if(window.event){return window.event.keyCode;}};textBoxArr[0].onmousedown=function(){t.closeACList()};textBoxArr[0].onkeydown=function(keyressed){var keyCode=getKeyCode(keyressed);if((keyCode!=38)&&(keyCode!=40)){}else{if(frm.style.display==''){var newRowSelected=rowSelectedId;if(keyCode!=38){if(newRowSelected<ACResultsLength-1)newRowSelected++;t.changeColor(document.getElementById("results"+newRowSelected+"_"+id),newRowSelected)}else{if(newRowSelected>0)newRowSelected--;t.changeColor(document.getElementById("results"+newRowSelected+"_"+id),newRowSelected)}textBoxArr[0].value=document.getElementById("results"+newRowSelected+"_"+id).innerHTML;setTextRange(textBoxArr[0],textBoxArr[0].value.length,textBoxArr[0].value.length)}}t.onkeydown(keyressed);};t.getACOuternal=function(nKeyCode){getACInternal(nKeyCode)};var getACInternal=function(nKeyCode){lastKeyCodePressed=nKeyCode;var val=textBoxArr[0].value.substring(0,getCaretPos(textBoxArr[0]));if(val!=""){moreQ="";if(textBoxArr[1]==null)moreQ+="q0="+encoding.fixTextForUTF8(val)+"&";else{qNumber=textBoxArr.length-1;for(i=0;i<textBoxArr.length;i++){if(textBoxArr[i]!=null){moreQ+="q"+(qNumber)+"="+encoding.fixTextForUTF8(textBoxArr[i].value)+"&";qNumber--;}}}zipCodeValue="";if(_zipCode!=null){if(_zipCode.value!=null)zipCodeValue=_zipCode.value;else zipCodeValue=_zipCode;}parameters="countrycode="+_SettingsRequest.countryCode+"&"+moreQ+"lang="+_SettingsRequest.language+"&resultslimit="+_SettingsRequest.resultsLimit+"&zipcode="+zipCodeValue;autoSuggestFlash.runFunction("","getSuggest",parameters,id)}else{mainDiv.style.display='none';frm.style.display='none'}};t.onkeydown=function(keyressed){};t.onkeyup=function(keyressed){};textBoxArr[0].onblur=function(keyressed){window.clearInterval(autoSuggestIntervalId);autoSuggestIntervalId=null};textBoxArr[0].onkeyup=function(keyressed){var keyCode=getKeyCode(keyressed);if(keyCode!=13){if((keyCode!=38)&&(keyCode!=40)){if(autoSuggestIntervalId!=null){window.clearInterval(autoSuggestIntervalId);autoSuggestIntervalId=null}autoSuggestIntervalObject=t;autoSuggestIntervalId=window.setInterval("autoSuggestInterval("+keyCode+")",200)}else{}}else{if(frm.style.display==''){t.setACFieldValue()}}t.onkeyup(keyressed);};t.changeColor=function(td,_rowSelectedId){if(rowSelectedId!=null){if(_rowSelectedId!=rowSelectedId){td.style.backgroundColor='#3366CC';td.style.color='#FFFFFF';getElement(mainDiv,'TD',"results"+rowSelectedId+"_"+id).style.backgroundColor='';getElement(mainDiv,'TD',"results"+rowSelectedId+"_"+id).style.color=fontColor;if(mainDiv.style.overflowY=="scroll"){if(_rowSelectedId<rowSelectedId){if(mainDiv.scrollTop>(_rowSelectedId*getElement(mainDiv,'TD',"results0"+"_"+id).offsetHeight)){mainDiv.scrollTop-=getElement(mainDiv,'TD',"results0"+"_"+id).offsetHeight}}else{if(mainDiv.scrollTop<(_rowSelectedId*getElement(mainDiv,'TD',"results0"+"_"+id).offsetHeight)-((numOfResults/2-1)*document.getElementById("results0"+"_"+id).offsetHeight)){mainDiv.scrollTop+=getElement(mainDiv,'TD',"results0"+"_"+id).offsetHeight}}}rowSelectedId=_rowSelectedId}}};var setTextRange=function(textBox,iStart,iLength){if(textBox.createTextRange){var oRange=textBox.createTextRange();oRange.moveStart("character",iStart);oRange.moveEnd("character",iLength-textBox.value.length);oRange.select();}else if(textBox.setSelectionRange){textBox.setSelectionRange(iStart,iLength);}textBox.focus();};var getCaretPos=function(el){if(typeof el.selectionStart!="undefined"){return el.selectionStart;}else{if(document.selection){return Math.abs(document.selection.createRange().moveStart("character",-1000000));}}};t.closeACList=function(allow){if(mainDiv.style.display==''){}mainDiv.style.display='none';frm.style.display='none'};t.setACFieldValue=function(){val=getElement(mainDiv,'TD',"results"+rowSelectedId+"_"+id).innerHTML;textBoxArr[0].value=val;t.closeACList();setTextRange(textBoxArr[0],textBoxArr[0].value.length,textBoxArr[0].value.length)};t.setACFieldMouseOver=function(_td,_rowSelectedId){val=_td.innerHTML;textBoxArr[0].value=val;setTextRange(textBoxArr[0],textBoxArr[0].value.length,textBoxArr[0].value.length);_publicChangeColor(_td,_rowSelectedId)};var trim=function(str){return str.replace(/^\s*|\s*$/g,"");};var getElement=function(oParent,tagName,tagId){var elementsList=oParent.getElementsByTagName(tagName);var i;for(var i=0;i<elementsList.length;i++){if(elementsList[i].id==tagId){return elementsList[i]}}};function setACResults(){if(arguments.length>0){var val=textBoxArr[0].value.substring(0,getCaretPos(textBoxArr[0]));ACResultsLength=arguments.length;if((arguments.length==1)&&(trim(textBoxArr[0].value)==trim(arguments[0]))){t.closeACList(false);return false;}else{var str="<Div id='ResultsDiv"+id+"' style='direction:"+ACDirection+"; overflow-x:hidden;text-align: "+alignment+"'><Table width='100%'; Height='1' Cellpadding='0' Cellspacing='0'>";var i;_publicChangeColor=t.changeColor;_publicSetACFieldValue=t.setACFieldValue;_publicSetACFieldMouseOver=t.setACFieldMouseOver;if(checkKeyCode(lastKeyCodePressed)){var val=textBoxArr[0].value.substring(0,getCaretPos(textBoxArr[0]));textLength=val.length;if(val.toLowerCase()==arguments[0].substring(0,val.length).toLowerCase()){textBoxArr[0].value=unescape(arguments[0]);setTextRange(textBoxArr[0],textLength,textBoxArr[0].value.length)}}for(i=0;i<arguments.length;i++){str+="<TR><TD id='results"+i+"_"+id+"' Align='"+alignment+"' style='direction:"+ACDirection+";padding-left:3px;padding-right:3px;cursor:pointer;color:"+fontColor+";font-size:"+fontSize+"px;font-family:"+fontFamily+"' title='"+arguments[i]+"' onmouseover='_publicSetACFieldMouseOver(this,"+i+")' onclick='_publicSetACFieldValue()'>"+unescape(arguments[i])+"</TD></TR>"}t.resultList=arguments;str+="</Table></Div>";mainDiv.innerHTML=str;mainDiv.style.display='';frm.style.display='';var pos=getDivPosByTextBoxPos(textBoxArr[0]);posX=pos.x+1+offsetLeft;posY=pos.y+textBoxArr[0].offsetHeight+1+offsetTop;sWidth=parseInt(textBoxArr[0].offsetWidth)+offsetWidth-2;mainDiv.style.width=sWidth+"px";containerDiv.style.left=posX+"px";containerDiv.style.top=posY+"px";if(autoResultsFit){sHeight=getElement(mainDiv,'TD','results0_'+id).offsetHeight*arguments.length;sScroll="hidden"}else{if(arguments.length>numOfResults){sHeight=getElement(mainDiv,'TD','results0_'+id).offsetHeight*numOfResults;sScroll="scroll"}else{sHeight=getElement(mainDiv,'DIV','ResultsDiv'+id).offsetHeight;sScroll="hidden"}}sHeight+=offsetHeight;frm.style.height=sHeight+"px";mainDiv.style.height=sHeight+"px";frm.style.width="100%";mainDiv.style.overflowY=sScroll;mainDiv.scrollTop=0;rowSelectedId=0;var firstTd=getElement(mainDiv,'TD',"results"+rowSelectedId+"_"+id);if(firstTd!=undefined){firstTd.style.backgroundColor='#3366CC';firstTd.style.color='#FFFFFF'}}}else t.closeACList();};var getDivPosByTextBoxPos=function(textBox){var pos={x:0,y:0};var el=textBox;var x=0;var y=textBox.offsetHeight;while((el.offsetParent)&&(el.tagName.toLowerCase()!='body')){pos.x+=el.offsetLeft;pos.y+=el.offsetTop;el=el.offsetParent;}pos.x+=el.offsetLeft;pos.y+=el.offsetTop;return pos;};t.setZipCode=function(obg){_zipCode=obg;}};AutoSuggest.EVENT_AUTO_SUGGEST_RESULT="onautosuggestresult";function ContextMenu(){var t=this;var itemsList=new Array();t.toString=function(){return "contextMenu"};t.addItem=function(caption,callbackFunction,separatorBefore){var menuItem={caption:caption,callbackFunction:callbackFunction,separatorBefore:separatorBefore};itemsList.push(menuItem);};t.removeItem=function(caption){};t.getItemsList=function(){return itemsList;};t.onContextMenuItemClicked=function(itemCaption,coordinate){for(var i=0;i<itemsList.length;i++){if(itemsList[i].caption==itemCaption){itemsList[i].callbackFunction.apply(this,new Array(itemCaption,coordinate));break;}}}};EventListener.objectId=0;function EventListener(){var t=this;var eventsArr=new Array();t.objectId=EventListener.objectId;t.addFlashEvent=false;EventListener.objectId++;t.toString=function(){return "eventListener"};t.addListener=function(evt,callFunction){var i;for(i=0;i<eventsArr.length;i++){if((eventsArr[i][0]==evt)&&(eventsArr[i][1]==callFunction)&&(eventsArr[i][2]==t)){return false;}}var ArrLength=eventsArr.length;eventsArr[ArrLength]=new Array(3);eventsArr[ArrLength][0]=evt;eventsArr[ArrLength][1]=callFunction;eventsArr[ArrLength][2]=t;if(t.addFlashEvent)flashListener.addListener(this.objectId,this.flashCallBackEvent,evt)};t.removeListener=function(evt,callFunction){var i,j;for(i=0;i<eventsArr.length;i++){if((eventsArr[i][0]==evt)&&(eventsArr[i][1]==callFunction)&&(eventsArr[i][2]==t)){for(j=i+1;j<eventsArr.length;j++){eventsArr[j-1][0]=eventsArr[j][0];eventsArr[j-1][1]=eventsArr[j][1];eventsArr[j-1][2]=eventsArr[j][2]}eventsArr.length--;return false;}}};t.removeAllListeners=function(){eventsArr.length=0;eventsArr=new Array();};t.triggerEvent=function(evt,args){var i;var parserArgs=t.parserArgs(evt,args);if(parserArgs=="")parserArgs=new Array();var isEventFound=false;for(i=0;i<eventsArr.length;i++){if(eventsArr[i][0]==evt){if(isEventFound){parserArgs[0]=eventsArr[i][2]}else{parserArgs.unshift(eventsArr[i][2])}eventsArr[i][1].apply(this,parserArgs);isEventFound=true}}};t.parserArgs=function(evt,args){return args;}};flashListener=new FlashListener();function FlashListener(){var t=this;var eventsArr=new Array();t.addListener=function(objectid,callBackEvent,evt){var i;for(i=0;i<eventsArr.length;i++){if((eventsArr[i][0]==objectid)&&(eventsArr[i][1]==callBackEvent)&&(eventsArr[i][2]==evt)){return false;}}var ArrLength=eventsArr.length;eventsArr[ArrLength]=new Array(3);eventsArr[ArrLength][0]=objectid;eventsArr[ArrLength][1]=callBackEvent;eventsArr[ArrLength][2]=evt};t.removeListener=function(objectid,callBackEvent,evt){var i,j;for(i=0;i<eventsArr.length;i++){if((eventsArr[i][0]==objectid)&&(eventsArr[i][1]==callBackEvent)&&(eventsArr[i][2]==evt)){for(j=i+1;j<eventsArr.length;j++){eventsArr[j-1][0]=eventsArr[j][0];eventsArr[j-1][1]=eventsArr[j][1];eventsArr[j-1][2]=eventsArr[j][2]}eventsArr.length--;return false;}}};t.removeAllListeners=function(){eventsArr.length=0;eventsArr=new Array();};t.triggerEvent=function(objectid,evt,args){var i;for(i=0;i<eventsArr.length;i++){if((eventsArr[i][0]==objectid)&&(eventsArr[i][2]==evt)){eventsArr[i][1].call(this,eventsArr[i][2],args);}}}};Layer.prototype=new EventListener();function Layer(_name){this.EventListener=EventListener;this.EventListener();var t=this;var name=_name;var type=Layer.TYPE_MAP_LAYER;t.parent=null;t.parentLayersListPos=null;var locked=false;var visible=true;var maxZoom=100;var minZoom= -100;var autoRedraw=false;t.toString=function(){return "layer"};t.getType=function(){return type;};t.getName=function(){return name;};t.initParentParams=function(_parent,_parentLayersListPos){t.parent=_parent;t.parentLayersListPos=_parentLayersListPos;};t.enableAutoRedraw=function(){autoRedraw=true};t.disableAutoRedraw=function(){autoRedraw=false};t.isAutoRedrawEnabled=function(){return autoRedraw};t.setMaxZoom=function(_maxZoom){maxZoom=_maxZoom;};t.getMaxZoom=function(){return maxZoom;};t.setMinZoom=function(_minZoom){minZoom=_minZoom;};t.getMinZoom=function(){return minZoom;};t.redraw=function(){if(t.isVisible()){t.triggerEvent(Layer.EVENT_LAYER_MODIFIED,new Array(this,""+t.parentLayersListPos,"redraw"))}};t.show=function(){if(!t.isVisible()){visible=true;t.triggerEvent(Layer.EVENT_LAYER_MODIFIED,new Array(this,""+t.parentLayersListPos,"show"))}};t.hide=function(){if(t.isVisible()){visible=false;t.triggerEvent(Layer.EVENT_LAYER_MODIFIED,new Array(this,""+t.parentLayersListPos,"hide"))}};t.isVisible=function(){return visible};t.lock=function(){locked=true};t.unLock=function(){locked=false};t.isLocked=function(){return locked};t.onShapeModified=function(_tileId,_shapeId,_type){t.triggerEvent(Layer.EVENT_SHAPE_MODIFIED,new Array(this,_tileId,""+t.parentLayersListPos,_shapeId,_type))}};Layer.TYPE_MAP_LAYER="typemaplayer";Layer.TYPE_VECTOR_LAYER="typevectorlayer";Layer.TYPE_LAYERS_COLLECTION="typelayerscollection";Layer.TYPE_LAYERS_MANAGER="typelayersmanager";Layer.EVENT_ADD_SHAPES="eventaddshapes";Layer.EVENT_LAYER_MODIFIED="eventlayermodified";Layer.EVENT_SHAPE_MODIFIED="eventshapemodified";VectorLayer.prototype=new Layer();function VectorLayer(_name){this.Layer=Layer;this.Layer(_name);var t=this;var type=Layer.TYPE_VECTOR_LAYER;var defaultLineStyle=new LineStyle(1,"359F6A",100);var defaultBrushStyle=new BrushStyle("3DB87A",60);var defaultIcon=null;t.toString=function(){return "vectorLayer"};t.getType=function(){return type;};t.setDefaultLineStyle=function(_defaultLineStyle){defaultLineStyle=_defaultLineStyle};t.getDefaultLineStyle=function(){return defaultLineStyle;};t.setDefaultBrushStyle=function(_defaultBrushStyle){defaultBrushStyle=_defaultBrushStyle};t.getDefaultBrushStyle=function(){return defaultBrushStyle;};t.addShape=function(){};t.removeShape=function(){};t.getShapesToDraw=function(){};t.updateShape=function(shapeId,pos,record,value){};t.setDefaultIcon=function(icon){defaultIcon=icon};t.getDefaultIcon=function(){return defaultIcon;}};VectorLayer.TYPE_LOCAL_VECTOR_LAYER="typelocalvectorlayer";VectorLayer.TYPE_REMOTE_VECTOR_LAYER="typeremotevectorlayer";LocalVectorLayer.prototype=new VectorLayer();function LocalVectorLayer(_name){this.VectorLayer=VectorLayer;this.VectorLayer(_name);var t=this;var type=Layer.TYPE_LOCAL_VECTOR_LAYER;var shapesList=new Array();var RequestTiles=new Array();shapesListCounter=0;var visible=true;var locked=false;t.parent=null;t.parentLayersListPos=null;var gridSquareSize=150;var maxPointsInGridSquare=3;var clusteringLevel=LocalVectorLayer.CLUSTERING_MEDIUM;var cacheTiles=new Array();var cacheZoomPower;t.toString=function(){return "localVectorLayer"};t.getType=function(){return type;};t.setCustomClustering=function(_gridSquareSize,_maxPointsInGridSquare){gridSquareSize=_gridSquareSize;maxPointsInGridSquare=_maxPointsInGridSquare};t.setClustering=function(_clusteringLevel){switch(_clusteringLevel){case LocalVectorLayer.CLUSTERING_NONE:gridSquareSize=1000;maxPointsInGridSquare=10000;break;case LocalVectorLayer.CLUSTERING_LOW:gridSquareSize=150;maxPointsInGridSquare=5;break;case LocalVectorLayer.CLUSTERING_MEDIUM:gridSquareSize=150;maxPointsInGridSquare=3;break;case LocalVectorLayer.CLUSTERING_HIGH:gridSquareSize=100;maxPointsInGridSquare=2;break;}clusteringLevel=_clusteringLevel};t.addShape=function(shape){switch(shape.toString()){case "marker":coordinate=shape.getCoordinate();shapesList.push(new MarkerRecord(shape.getId(),coordinate.getMapX(),coordinate.getMapY(),shape.icon.getId(),shape.getLabel(),shape.getHint(),shape.isVisible(),shape.isLabelVisible(),shape.direction));shape.initParentParams(this,shapesList.length-1);break;case "polygon":var lineStyle=shape.getLineStyle();var brushStyle=shape.getBrushStyle();shapesList.push(new PolyRecord(Shape.POLYGON,shape.getId(),shape.getVerticesString(),lineStyle,brushStyle,shape.getLabel(),shape.getHint(),shape.isVisible(),shape.isLabelVisible()));shape.initParentParams(this,shapesList.length-1);break;case "polyline":var lineStyle=shape.getLineStyle();shapesList.push(new PolyRecord(Shape.POLYLINE,shape.getId(),shape.getVerticesString(),lineStyle,null,shape.getLabel(),shape.getHint(),shape.isVisible(),shape.isLabelVisible()));shape.initParentParams(this,shapesList.length-1);break;case "circle":var lineStyle=shape.getLineStyle();var brushStyle=shape.getBrushStyle();shapesList.push(new CircleRecord(shape.getId(),shape.getCoordinateString(),lineStyle,brushStyle,shape.getLabel(),shape.getHint(),shape.isVisible(),shape.isLabelVisible()));shape.initParentParams(this,shapesList.length-1);break;}};t.removeShape=function(shape){var id=shape.getId();t.removeShapeById(id)};t.removeShapeById=function(id){var i,j;for(i=0;i<shapesList.length;i++){if(shapesList[i].shapeId==id){var shape=t.getShapeByIndex(i);if(t.isAutoRedrawEnabled()){t.onShapeModified(shapesList[i].tileId,i,"remove")}if(shapesList.length>1)shapesList[i]=shapesList[shapesList.length-1];shapesList.length-=1;return shape;}}return null;};t.removeAll=function(){var i,j;shapesList.length=0;t.redraw();return null;};var isTileInCache=function(tile,zoomPower){var i;for(i=0;i<cacheTiles.length;i++){if((zoomPower==cacheZoomPower)&&(cacheTiles[i][0]==tile[0])&&(cacheTiles[i][1]==tile[1])&&(cacheTiles[i][2]==tile[2])&&(cacheTiles[i][3]==tile[3])){return true;}}return false;};var getShapesByGridList=function(parentsArrPos,shapeIndex,tilesGridList,zoomPower,redraw){var getShape=function(){var shape=shapesList[i];isFound=false;if(shape.visible){for(j=0;j<tilesGridList.length;j++){var tileGrid=tilesGridList[j];switch(shape.shapeType){case Shape.MARKER:if((shape.x<tileGrid.minX)||(shape.y<tileGrid.minY)||(shape.x>tileGrid.maxX)||(shape.y>tileGrid.maxY)){}else{var grid=tileGrid.grid;x=Math.round(shape.x*zoomPower);y=Math.round(shape.y*zoomPower);squareX=Math.ceil(((x-tileGrid.screenMinX)+tileGrid.deltaGridX)/gridSquareSize);squareY=Math.ceil(((y-tileGrid.screenMinY)+tileGrid.deltaGridY)/gridSquareSize);if(squareX==0)squareX=1;if(squareY==0)squareY=1;if(grid[squareX-1][squareY-1]==null)grid[squareX-1][squareY-1]=0;if((redraw)&&(shape.tileId==tileGrid.tileId)){returnedShapesList.push(Shape.MARKER,tileGrid.tileId,parentsArrPos,i,shape.label,shape.hint,shape.visible,shape.labelVisible,shape.x,shape.y,shape.icon,shape.direction)}else{if(grid[squareX-1][squareY-1]<maxPointsInGridSquare){grid[squareX-1][squareY-1]+=1;returnedShapesList.push(Shape.MARKER,tileGrid.tileId,parentsArrPos,i,shape.label,shape.hint,shape.visible,shape.labelVisible,shape.x,shape.y,shape.icon,shape.direction);isFound=true;}}}break;case Shape.POLYGON:lineStyle=shape.lineStyle;if(lineStyle==null)lineStyle=defaultLineStyle;brushStyle=shape.brushStyle;if(brushStyle==null)brushStyle=defaultBrushStyle;returnedShapesList.push(Shape.POLYGON,tileGrid.tileId,parentsArrPos,i,shape.label,shape.hint,shape.visible,shape.labelVisible,shape.verticesString,lineStyle.width,lineStyle.color,lineStyle.alpha,brushStyle.color,brushStyle.alpha);isFound=true;break;case Shape.POLYLINE:lineStyle=shape.lineStyle;if(lineStyle==null)lineStyle=defaultLineStyle;returnedShapesList.push(Shape.POLYLINE,tileGrid.tileId,parentsArrPos,i,shape.label,shape.hint,shape.visible,shape.labelVisible,shape.verticesString,lineStyle.width,lineStyle.color,lineStyle.alpha);isFound=true;break;case Shape.CIRCLE:lineStyle=shape.lineStyle;if(lineStyle==null)lineStyle=defaultLineStyle;brushStyle=shape.brushStyle;if(brushStyle==null)brushStyle=defaultBrushStyle;returnedShapesList.push(Shape.CIRCLE,tileGrid.tileId,parentsArrPos,i,shape.label,shape.hint,shape.visible,shape.labelVisible,shape.coordinateString,lineStyle.width,lineStyle.color,lineStyle.alpha,brushStyle.color,brushStyle.alpha);isFound=true;break;}if(isFound){shapesList[i].tileId=tileGrid.tileId;break;}}}};var returnedShapesList=new Array();var i;var j;var tileGrid;var grid;var isFound;var lineStyle;var brushStyle;var defaultLineStyle=t.getDefaultLineStyle();var defaultBrushStyle=t.getDefaultBrushStyle();if(shapeIndex!=null){var start=shapeIndex;var end=shapeIndex+1}else{var start=0;var end=shapesList.length}if(clusteringLevel==LocalVectorLayer.CLUSTERING_NONE){for(i=end-1;i>=start;i--){getShape(i)}}else{for(i=start;i<end;i++){getShape(i)}}return returnedShapesList;};var createTilesGrid=function(tilesList,zoomPower,blockWidth,blockHeight){var tilesGridList=new Array();for(z=0;z<tilesList.length;z++){tile=tilesList[z];minX=tile[0];minY=tile[1];maxX=tile[2];maxY=tile[3];tileId=minX+""+minY+""+String(zoomPower).replace(".","");var numCellsX=Math.ceil(blockWidth/gridSquareSize)+1;var numCellsY=Math.ceil(blockHeight/gridSquareSize)+1;var grid=new Array(numCellsX*numCellsY);for(i=0;i<=numCellsX;i++){grid[i]=new Array(numCellsY);}screenMinX=Math.round(minX*zoomPower);screenMinY=Math.round(minY*zoomPower);deltaGridX=(Math.ceil(screenMinX/gridSquareSize)*gridSquareSize)-screenMinX;deltaGridY=(Math.ceil(screenMinY/gridSquareSize)*gridSquareSize)-screenMinY;tilesGridList.push({grid:grid,tileId:minX+""+minY+""+String(zoomPower).replace(".",""),minX:minX,minY:minY,maxX:maxX,maxY:maxY,screenMinX:screenMinX,screenMinY:screenMinY,deltaGridX:deltaGridX,deltaGridY:deltaGridY})}return tilesGridList;};t.getShapeToDraw=function(parentsArrPos,shapeListPos,tiles,zoomPower,blockWidth,blockHeight,requestId){if(t.isVisible()){var zoomLevel=Math.log(zoomPower)/Math.log(2);if((zoomLevel<=t.getMaxZoom())&&(zoomLevel>=t.getMinZoom())){var tilesGridList=createTilesGrid(tiles,zoomPower,blockWidth,blockHeight);return getShapesByGridList(parentsArrPos,shapeListPos,tilesGridList,zoomPower,true)}}};t.getShapesToDraw=function(tiles,zoomPower,blockWidth,blockHeight,projection,parentsArrPos,requestId){var returnedShapesList=new Array();if(t.isVisible()){if(RequestTiles[requestId]==null){RequestTiles[requestId]={shownShapesList:new Array(),tilesGridList:null,cacheTiles:null}}var request=RequestTiles[requestId];var shownShapesList=request.shownShapesList;var cacheTiles=request.cacheTiles;var zoomLevel=Math.log(zoomPower)/Math.log(2);if((zoomLevel<=t.getMaxZoom())&&(zoomLevel>=t.getMinZoom())){var z;var i;var j;var squareX;var squareY;var tile;var tileId;var shape;for(z=0;z<tiles.tilesToRemove.length;z++){tile=tiles.tilesToRemove[z];tileId=tile[0]+""+tile[1]+""+tiles.tilesToRemoveZoomPower;shownShapesList[tileId]=null}var tilesList=tiles.tilesToAdd;var tilesGridList=createTilesGrid(tilesList,zoomPower,blockWidth,blockHeight);returnedShapesList=getShapesByGridList(parentsArrPos,null,tilesGridList,zoomPower);RequestTiles[requestId].cacheTiles=tiles.currentTiles;RequestTiles[requestId].tilesGridList=tilesGridList;cacheZoomPower=zoomPower}}return returnedShapesList;};t.redrawShape=function(pos){t.onShapeModified(shapesList[pos].tileId,pos)};t.updateShape=function(shapeId,pos,record,value,disallowRedraw){if(shapesList[pos].shapeId==shapeId){shapesList[pos][record]=value;if((t.isAutoRedrawEnabled())&&(disallowRedraw!=true)){t.redrawShape(pos)}}else{}};t.getBounds=function(){var i,j;var returnedShapesList=new Array(shapesList.length);for(i=0;i<shapesList.length;i++){returnedShapesList[i]=t.getShapeByIndex(i)}return returnedShapesList;};t.getShapes=function(){var i,j;var returnedShapesList=new Array(shapesList.length);for(i=0;i<shapesList.length;i++){returnedShapesList[i]=t.getShapeByIndex(i)}return returnedShapesList;};t.getShapeById=function(id){var i,j;for(i=0;i<shapesList.length;i++){if(shapesList[i].shapeId==id){return t.getShapeByIndex(i);}}return null;};var createPolyCoordinatesList=function(verticesString){verticesList=verticesString.split("^");var coordinatesList=new Array(verticesList.length);var coordinate;for(var i=0;i<verticesList.length;i++){var coordinate=verticesList[i].split(",");coordinatesList[i]=new projector.createClientCoordinate(coordinate[0],coordinate[1])}return coordinatesList;};t.getShapeByIndex=function(index){var shape=shapesList[index];switch(shape.shapeType){case Shape.MARKER:var returnedShape=new Marker(shape.shapeId,new projector.createClientCoordinate(shape.x,shape.y),shape.icon,shape.label,shape.hint,shape.visible,shape.labelVisible,shape.direction,shape.attributesList);break;case Shape.POLYGON:coordinatesList=createPolyCoordinatesList(shape.verticesString);var returnedShape=new Polygon(shape.shapeId,coordinatesList,shape.lineStyle,shape.brushStyle,shape.label,shape.hint,shape.visible,shape.labelVisible);break;case Shape.POLYLINE:coordinatesList=createPolyCoordinatesList(shape.verticesString);var returnedShape=new Polyline(shape.shapeId,coordinatesList,shape.lineStyle,shape.label,shape.hint,shape.visible,shape.labelVisible);break;case Shape.CIRCLE:var coordinate=shape.coordinateString.split("^");var returnedShape=new Circle(shape.shapeId,new projector.createClientCoordinate(coordinate[0],coordinate[1]),coordinate[2],shape.lineStyle,shape.brushStyle,shape.label,shape.hint,shape.visible,shape.labelVisible);break;}returnedShape.initParentParams(this,index);return returnedShape;}};LocalVectorLayer.CLUSTERING_NONE="0";LocalVectorLayer.CLUSTERING_LOW="1";LocalVectorLayer.CLUSTERING_MEDIUM="2";LocalVectorLayer.CLUSTERING_HIGH="3";RemoteVectorLayer.prototype=new VectorLayer();function RemoteVectorLayer(_name){this.VectorLayer=VectorLayer;this.VectorLayer(_name);var t=this;var type=VectorLayer.TYPE_REMOTE_VECTOR_LAYER;var shapesList=new Array();var cacheTiles=new Array();var cacheZoomPower;var visible=true;var isHintVisible=true;var RequestLoadedTilesQueue=new Array();var serverLayerId;var criticalSection=0;var baseURL="";var url="";var cacheParam=Math.floor(Math.random()*1000000);var iconsList=new Array();t.toString=function(){return "remoteVectorLayer"};t.getType=function(){return type;};t.setURL=function(_url,useCacheParam){url=_url;baseURL=url;var qPos=baseURL.indexOf("?");if(qPos!= -1){if(qPos!=baseURL.length-1){baseURL=url+"&"}}else{baseURL=url+"?"}if(useCacheParam){baseURL=baseURL+"_cp_="+cacheParam+"&"}};t.getURL=function(){return url;};t.refreshCacheParam=function(){cacheParam=Math.floor(Math.random()*1000000);};t.redraw=function(){t.refreshCacheParam();t.setURL(t.getURL(),true);if(t.isVisible()){t.triggerEvent(Layer.EVENT_LAYER_MODIFIED,new Array(this,""+t.parentLayersListPos,"redraw"))}};t.setServerLayerId=function(_serverLayerId){serverLayerId=_serverLayerId};t.setIconsList=function(_iconsList){iconsList=_iconsList};t.show=function(){if(!t.isVisible()){visible=true;t.triggerEvent(Layer.EVENT_LAYER_MODIFIED,new Array(this,""+t.parentLayersListPos,"show"))}};t.hide=function(){while(criticalSection>0)criticalSection++;if(t.isVisible()){visible=false;t.triggerEvent(Layer.EVENT_LAYER_MODIFIED,new Array(this,""+t.parentLayersListPos,"hide"))}criticalSection--};t.isVisible=function(){return visible};t.setHintVisible=function(_isHintVisible){isHintVisible=_isHintVisible};t.getShapeByIndex=function(shapePos){var shape=shapesList[shapePos];switch(shape.shapeType){case Shape.MARKER:return new Marker("Marker1",new projector.createClientCoordinate(shape.x,shape.y),shape.icon,shape.label,shape.hint,true,true,shape.direction,shape.attributesList);break;case Shape.POLYGON:break;}};var isTileInCache=function(tile,zoomPower){var i;for(i=0;i<cacheTiles.length;i++){if((zoomPower==cacheZoomPower)&&(cacheTiles[i][0]==tile[0])&&(cacheTiles[i][1]==tile[1])&&(cacheTiles[i][2]==tile[2])&&(cacheTiles[i][3]==tile[3])){return true;}}return false;};var isTilesEquals=function(tileA,tileB){if((tileA[0]==tileB[0])&&(tileA[1]==tileB[1])&&(tileA[2]==tileB[2])&&(tileA[3]==tileB[3])){return true;}return false;};t.getShapesToDraw=function(tiles,zoomPower,blockWidth,blockHeight,projection,parentsArrPos,requestId){while(criticalSection>0)criticalSection++;if(t.isVisible()){if(RequestLoadedTilesQueue[requestId]==null){RequestLoadedTilesQueue[requestId]={loadedTilesQueue:new Array(),loadedTilesQueueIndex:0}}var request=RequestLoadedTilesQueue[requestId];var horizontal;var vertical;var url;var tile;var j;var zoomLevel=Math.log(zoomPower)/Math.log(2);if((zoomLevel<=t.getMaxZoom())&&(zoomLevel>=t.getMinZoom())){var tilesList=tiles.currentTiles;var tilesToAdd=tiles.tilesToAdd;var tileToRemove=tiles.tilesToRemove;newLoadedTilesQueue=new Array();unloadedTilesQueueIndex=request.loadedTilesQueueIndex-1;if(unloadedTilesQueueIndex== -1)unloadedTilesQueueIndex++;for(i=0;i<tilesList.length;i++){isTileFound=false;for(j=unloadedTilesQueueIndex;j<request.loadedTilesQueue.length;j++){if(isTilesEquals(tilesList[i],request.loadedTilesQueue[j].tile)){isTileFound=true;break;}}if(!isTileFound){for(j=0;j<tilesToAdd.length;j++){if(isTilesEquals(tilesList[i],tilesToAdd[j])){isTileFound=true;break;}}}if(isTileFound){tile=tilesList[i];horizontal=tile[0];vertical=tile[1];url=baseURL+"layerId="+serverLayerId+"&width="+blockWidth+"&height="+blockHeight+"&horizontal="+horizontal+"&vertical="+vertical+"&zoomLevel="+zoomLevel+"&projection="+projection;newLoadedTilesQueue.push({url:url,tile:tile,zoomPower:zoomPower,parentsArrPos:parentsArrPos,requestId:requestId,isLoaded:false})}}request.loadedTilesQueue=newLoadedTilesQueue;request.loadedTilesQueueIndex=0;if(request.loadedTilesQueue.length>0){var _tile=request.loadedTilesQueue[0];request.loadedTilesQueueIndex++;loadXml(_tile.url,_tile.tile,_tile.zoomPower,_tile.parentsArrPos,_tile.requestId,request.loadedTilesQueueIndex-1)}}}criticalSection--;return "";};var parseXML=function(xmlDoc,tile,zoomPower,parentsArrPos,requestId,tileQueueIndex){if(t.isVisible()){while(criticalSection>0)criticalSection++;var request=RequestLoadedTilesQueue[requestId];if((tileQueueIndex<=request.loadedTilesQueue.length)&&(request.loadedTilesQueue.length>0)){var _tile=request.loadedTilesQueue[tileQueueIndex];try{if(isTilesEquals(tile,_tile.tile)){if(!_tile.isLoaded){_tile.isLoaded=true;var i,j,z;var pointX,pointY;var markersList=new Array();var hint="";var baseElement=xmlDoc.getElementsByTagName("MapLayers");var returnedShapesList=new Array();if(baseElement.length>0){var featuresList=baseElement[0].getElementsByTagName("Layer");for(i=0;i<featuresList.length;i++){var itemsList=featuresList[i].getElementsByTagName("Shape");_layerName=featuresList[i].getAttribute("Name");for(j=0;j<itemsList.length;j++){pointX=itemsList[j].getElementsByTagName("X");horizontal=pointX[0].firstChild.nodeValue-0;pointY=itemsList[j].getElementsByTagName("Y");vertical=pointY[0].firstChild.nodeValue-0;var shapeAttributesList=new Array();attributesList=itemsList[j].attributes;for(var z=0;z<attributesList.length;z++){shapeAttributesList[attributesList[z].name]=attributesList[z].value}if((horizontal!=null)&&(vertical!=null)){var defaultIcon=t.getDefaultIcon();if(defaultIcon!=null){var _icon=defaultIcon.getId();}else{var iconNum=itemsList[j].getAttribute("Icon");try{var _icon=iconsList[iconNum].getId();}catch(a){var _icon="";}}shapesList.push(new MarkerRecord(j,horizontal,vertical,_icon,itemsList[j].getAttribute("Label"),itemsList[j].getAttribute("ToolTip"),true,true,itemsList[j].getAttribute("Direction"),shapeAttributesList));var shape=shapesList[shapesList.length-1];var tileId=tile[0]+""+tile[1]+""+zoomPower;var shapeArrPos=shapesList.length-1;if(isHintVisible)hint=shape.hint;returnedShapesList.push(Shape.MARKER,tileId,parentsArrPos,shapeArrPos,shape.label,hint,shape.visible,shape.labelVisible,shape.x,shape.y,shape.icon,shape.direction)}}}}t.triggerEvent(Layer.EVENT_ADD_SHAPES,new Array(requestId,tile,returnedShapesList));if(request.loadedTilesQueue.length>request.loadedTilesQueueIndex){var _tile=request.loadedTilesQueue[request.loadedTilesQueueIndex];request.loadedTilesQueueIndex++;loadXml(_tile.url,_tile.tile,_tile.zoomPower,_tile.parentsArrPos,_tile.requestId,request.loadedTilesQueueIndex-1)}else{request.loadedTilesQueueIndex=request.loadedTilesQueue.length+1}}}}catch(a){}}criticalSection--}};var loadXml=function(url,tile,zoomPower,parentsArrPos,requestId,tileQueueIndex){var xmlHttp;if(window.XMLHttpRequest){xmlHttp=new XMLHttpRequest();}else if(window.ActiveXObject){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}xmlHttp.open("GET",url,true);xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){parseXML(xmlHttp.responseXML,tile,zoomPower,parentsArrPos,requestId,tileQueueIndex)}}};xmlHttp.send(null);}};LayersCollection.prototype=new Layer();function LayersCollection(_name){this.Layer=Layer;this.Layer(_name);var t=this;var type=Layer.TYPE_LAYERS_COLLECTION;t.layersList=new Array();t.parent=null;t.parentLayersListPos=null;var atlasDefaultLayerShapeCounter=0;t.toString=function(){return "layersCollection"};t.getType=function(){return type;};t.runFlashFunction=function(){t.parent.getFlash().runFunction.apply(this,arguments);};t.createLocalVectorLayer=function(layerName){var layer=new LocalVectorLayer(layerName);t.addLayer(layer);return layer;};t.createRemoteVectorLayer=function(layerName){var layer=new RemoteVectorLayer(layerName);t.addLayer(layer);return layer;};t.addLayer=function(layer){var layerType=layer.getType();layer.addListener(Layer.EVENT_ADD_SHAPES,remoteVectorLayerResponse,layer);layer.addListener(Layer.EVENT_LAYER_MODIFIED,onLayerModified,layer);layer.addListener(Layer.EVENT_SHAPE_MODIFIED,onShapeModified,layer);t.layersList.push(layer);layer.initParentParams(this,t.layersList.length-1)};t.removeLayer=function(layerName){var i;for(i=0;i<t.layersList.length;i++){if(t.layersList[i].getName()==layerName){t.layersList[i].removeAll();}}};t.getLayerByName=function(layerName){var i;for(i=0;i<t.layersList.length;i++){if(t.layersList[i].getName()==layerName){return t.layersList[i]}}return null;};t.getLayers=function(){return t.layersList;};t.getLayerByIndex=function(layersIndexes){if(layersIndexes.length>1){firstElement=layersIndexes.shift();return t.layersList[firstElement].getLayerByIndex(layersIndexes)}else{return t.layersList[layersIndexes[0]]}};var onLayerModified=function(_object,_layer,_layerId,_type){t.triggerEvent(Layer.EVENT_LAYER_MODIFIED,new Array(_layer,""+t.parentLayersListPos+"^"+_layerId,_type))};var onShapeModified=function(_object,_layer,_tileId,_layerId,_shapeId,_type){t.triggerEvent(Layer.EVENT_SHAPE_MODIFIED,new Array(_layer,_tileId,""+t.parentLayersListPos+"^"+_layerId,_shapeId,_type))};var remoteVectorLayerResponse=function(layer,requestId,tile,returnedShapesList){if(t.isVisible()){t.triggerEvent(Layer.EVENT_ADD_SHAPES,new Array(requestId,tile,returnedShapesList))}};t.getShapesToDraw=function(tiles,zoomPower,blockWidth,blockHeight,projection,parentsArrPos,requestId){var shapesToDrawList=new Array();if(t.isVisible()){if(parentsArrPos=="")parentsArrPos="";else parentsArrPos=parentsArrPos+"^";var zoomLevel=Math.log(zoomPower)/Math.log(2);if((zoomLevel<=t.getMaxZoom())&&(zoomLevel>=t.getMinZoom())){for(var j=0;j<t.layersList.length;j++){resultArray=t.layersList[j].getShapesToDraw(tiles,zoomPower,blockWidth,blockHeight,projection,parentsArrPos+j,requestId);if(resultArray!="")shapesToDrawList.push(resultArray.join("~"))}}}return shapesToDrawList;};t.parserArgs=function(evt,args){switch(evt){case LayersManager.EVENT_POLYGON_BUILD:var i;lineStyle=new LineStyle(3,"00FF55",60);brushStyle=new BrushStyle("B63F3F",80);var polygon=new Polygon("Polygon"+atlasDefaultLayerShapeCounter,args,lineStyle,brushStyle,"My Label","My Hint");atlasDefaultLayerShapeCounter++;var atlasDefaultLayer=t.getLayerByName("AtlasDefaultLayer");atlasDefaultLayer.addShape(polygon);t.triggerEvent(LayersManager.EVENT_POLYGON_INSERT,args);return new Array(t);break;case LayersManager.EVENT_POLYLINE_BUILD:alert(";EVENT_POLYLINE_BUILD");return new Array(t);break;case LayersManager.EVENT_CIRCLE_BUILD:alert(";EVENT_CIRCLE_BUILD");return new Array(t);break;}return args;}};LayersManager.prototype=new LayersCollection();function LayersManager(){this.LayersCollection=LayersCollection;this.LayersCollection();var t=this;var type=Layer.TYPE_LAYERS_MANAGER;var mapsList=new Array();var BLOCK_WIDTH=500;var BLOCK_HEIGHT=300;var defaultLayerCounter=0;var isInitialized=false;var criticalSection=0;t.flashCallBackEvent=function(evt,args){t.triggerEvent(evt,args)};t.objectId="LM"+t.objectId;flashListener.addListener(t.objectId,this.flashCallBackEvent,LayersManager.EVENT_SHAPE_CLICK);flashListener.addListener(t.objectId,this.flashCallBackEvent,LayersManager.EVENT_SHAPE_MOUSE_OVER);flashListener.addListener(t.objectId,this.flashCallBackEvent,LayersManager.EVENT_SHAPE_MOUSE_OUT);flashListener.addListener(t.objectId,this.flashCallBackEvent,LayersManager.EVENT_POLYGON_BUILD);flashListener.addListener(t.objectId,this.flashCallBackEvent,LayersManager.EVENT_POLYLINE_BUILD);flashListener.addListener(t.objectId,this.flashCallBackEvent,LayersManager.EVENT_CIRCLE_BUILD);flashListener.addListener(t.objectId,this.flashCallBackEvent,LayersManager.EVENT_SHAPE_EDITED);flashListener.addListener(t.objectId,this.flashCallBackEvent,LayersManager.EVENT_SHAPE_SELECTED);flashListener.addListener(t.objectId,this.flashCallBackEvent,LayersManager.EVENT_MEASURE_EX_START);flashListener.addListener(t.objectId,this.flashCallBackEvent,LayersManager.EVENT_MEASURE_EX_SEGMENT);flashListener.addListener(t.objectId,this.flashCallBackEvent,LayersManager.EVENT_MEASURE_EX_END);t.toString=function(){return "layersManager"};t.getType=function(){return type;};t.attachMap=function(_map){for(var i=0;i<mapsList.length;i++){if(mapsList[i].map==_map)return false;}mapsList.push({map:_map,cacheTilesList:new Array(),cacheZoomPower:null});isInitialized=true;if(t.layersList.length>0)_map.addListener(Map.EVENT_MAP_MODIFIED,onMapModified,_map);_map.getFlash().runFunction(CUSTOM_CTRL_MOVIE_PATH,"SetLayerManagerId",t.objectId);if((_map.isMapInitialized)&&(t.layersList.length>0)){onMapModified(_map)}};t.setDefaultLayer=function(_layer){defaultLayer=_layer};t.getDefaultLayer=function(){return defaultLayer;};var getTiles=function(_mapObject){var map=_mapObject.map;var tiles={currentTiles:new Array(),tilesToAdd:new Array(),tilesToRemove:new Array(),tilesToRemoveZoomPower:new Array()};var i,j,z;var coordinate=map.getCenterPosition();var horzPos=coordinate.getMapX();var vertPos=coordinate.getMapY();var zoomPower=map.getZoomPower();horzPos=horzPos-(map.width/2)/zoomPower;vertPos=vertPos-(map.height/2)/zoomPower;mapBlockWidth=Math.ceil(BLOCK_WIDTH/zoomPower);mapBlockHeight=Math.ceil(BLOCK_HEIGHT/zoomPower);firstTileMapTopLeftX= -1*(mapBlockWidth-Math.abs(((Math.ceil(horzPos/mapBlockWidth)*mapBlockWidth)-horzPos)));firstTileMapTopLeftY= -1*(mapBlockHeight-Math.abs(((Math.ceil(vertPos/mapBlockHeight)*mapBlockHeight)-vertPos)));firstTileMapTopLeftX=Math.ceil(horzPos+(firstTileMapTopLeftX));firstTileMapTopLeftY=Math.ceil(vertPos+(firstTileMapTopLeftY));firstTilePosX=(firstTileMapTopLeftX-horzPos)*zoomPower;firstTilePosY=(firstTileMapTopLeftY-vertPos)*zoomPower;numOfTilesX=Math.ceil((map.width-firstTilePosX)/BLOCK_WIDTH);numOfTilesY=Math.ceil((map.height-firstTilePosY)/BLOCK_HEIGHT);posX=firstTileMapTopLeftX;posY=firstTileMapTopLeftY;var tilesList=tiles.currentTiles;for(i=0;i<numOfTilesX;i++){for(j=0;j<numOfTilesY;j++){overlappingArea=getMapAndTileOverlappingArea(horzPos,vertPos,zoomPower,map.width,map.height,posX,posY,posX+mapBlockWidth,posY+mapBlockHeight);tilesList.push(new Array(posX,posY,posX+mapBlockWidth,posY+mapBlockHeight,overlappingArea));posY+=mapBlockHeight}posX+=mapBlockWidth;posY=firstTileMapTopLeftY}sortTilesArray(tilesList);if(zoomPower!=_mapObject.cacheZoomPower){tiles.tilesToAdd=tilesList;var lastTiles=_mapObject.cacheTilesList.currentTiles;if(lastTiles==null){tiles.tilesToRemove=new Array();}else{tiles.tilesToRemove=_mapObject.cacheTilesList.currentTiles}}else{tiles.tilesToAdd=getUnoverlappingTiles(tilesList,_mapObject.cacheTilesList.currentTiles,true);tiles.tilesToRemove=getUnoverlappingTiles(_mapObject.cacheTilesList.currentTiles,tilesList)}tiles.tilesToRemoveZoomPower=_mapObject.cacheZoomPower;_mapObject.cacheTilesList=tiles;_mapObject.cacheZoomPower=zoomPower;return tiles;};function sortTilesArray(tilesArray){var i,j,tmp;for(i=0;i<tilesArray.length-1;i++){for(j=0;j<tilesArray.length-1-i;j++){if(tilesArray[j+1][4]>tilesArray[j][4]){tmp=tilesArray[j];tilesArray[j]=tilesArray[j+1];tilesArray[j+1]=tmp;}}}};var getUnoverlappingTiles=function(tilesListA,tilesListB,checkLoaded){var tilesList=new Array();var i,j,isTileFound;for(i=0;i<tilesListA.length;i++){isTileFound=false;for(j=0;j<tilesListB.length;j++){if((tilesListA[i][0]==tilesListB[j][0])&&(tilesListA[i][1]==tilesListB[j][1])&&(tilesListA[i][2]==tilesListB[j][2])&&(tilesListA[i][3]==tilesListB[j][3])){isTileFound=true;break;}}if(!isTileFound)tilesList.push(tilesListA[i]);}return tilesList;};var getMapAndTileOverlappingArea=function(horzPos,vertPos,zoomPower,mapWidth,mapHeight,xMin,yMin,xMax,yMax){xMin=(xMin-horzPos)*zoomPower;yMin=(yMin-vertPos)*zoomPower;xMax=(xMax-horzPos)*zoomPower;yMax=(yMax-vertPos)*zoomPower;if((xMax<0)||(xMin>mapWidth)||(yMax<0)|(yMin>mapHeight))return 0;xMin=Math.max(xMin,0);yMin=Math.max(yMin,0);xMax=Math.min(xMax,mapWidth);yMax=Math.min(yMax,mapHeight);return(xMax-xMin)*(yMax-yMin)};var isTileInTilesList=function(tile,tilesList){var i;for(i=0;i<tilesList.length;i++){if((tile[0]==tilesList[i][0])&&(tile[1]==tilesList[i][1])&&(tile[2]==tilesList[i][2])&&(tile[3]==tilesList[i][3])){return true;}}return false;};var onLayerModified=function(_object,_layer,_layerId,_type){for(var i=0;i<mapsList.length;i++){if(mapsList[i].map.isMapInitialized){var zoomPower=mapsList[i].map.getZoomPower();var projection=mapsList[i].map.getProjection();var cacheTilesList=mapsList[i].cacheTilesList;var tiles={currentTiles:cacheTilesList.currentTiles,tilesToAdd:cacheTilesList.currentTiles,tilesToRemove:cacheTilesList.currentTiles,tilesToRemoveZoomPower:cacheTilesList.tilesToRemoveZoomPower};if(_type==null)_type="a";if(_type.toLowerCase()=="hide"){tiles.currentTiles=new Array();tiles.tilesToAdd=new Array();mapsList[i].map.getFlash().runFunction(CUSTOM_CTRL_MOVIE_PATH,"onLayerModified",_layerId,"")}else{var shapesToDrawList=_layer.getShapesToDraw(tiles,mapsList[i].cacheZoomPower,BLOCK_WIDTH,BLOCK_HEIGHT,projection,_layerId,i);if(_type.toLowerCase()=="redraw"){if(shapesToDrawList=="")shapesToDrawList=new Array();mapsList[i].map.getFlash().runFunction(CUSTOM_CTRL_MOVIE_PATH,"onLayerModified",_layerId,shapesToDrawList.join("~"))}else{if(shapesToDrawList!="")mapsList[i].map.getFlash().runFunction(CUSTOM_CTRL_MOVIE_PATH,"onLayerModified",_layerId,shapesToDrawList.join("~"))}}}}};var onShapeModified=function(_object,_layer,_tileId,_layerId,_shapeId,_type){if(_tileId==null)_tileId="";for(var i=0;i<mapsList.length;i++){if(mapsList[i].map.isMapInitialized){if(_type!="remove"){var shapeToDrawList=_layer.getShapeToDraw(_layerId,_shapeId,mapsList[i].cacheTilesList.currentTiles,mapsList[i].cacheZoomPower,BLOCK_WIDTH,BLOCK_HEIGHT,i)}else shapeToDrawList=new Array();if(shapeToDrawList!=null){mapsList[i].map.getFlash().runFunction(CUSTOM_CTRL_MOVIE_PATH,"onShapeModified",_tileId,_layerId,_shapeId,shapeToDrawList.join("~"))}}}};t.redraw=function(){if(t.isVisible()){onLayerModified(this,this,0,"redraw")}};var draw=function(requestId,_mapObject){while(criticalSection>0)criticalSection++;var i,j;var _tiles=getTiles(_mapObject);var zoomPower=_mapObject.map.getZoomPower();var shapesToDrawList=new Array();var projection=_mapObject.map.getProjection();if(_tiles.tilesToAdd.length>0){shapesToDrawList=t.getShapesToDraw(_tiles,zoomPower,BLOCK_WIDTH,BLOCK_HEIGHT,projection,0,requestId);}var tilesToRemoveStr="";for(i=0;i<_tiles.tilesToRemove.length;i++){tilesToRemoveStr+=_tiles.tilesToRemove[i][0]+""+_tiles.tilesToRemove[i][1]+String(_tiles.tilesToRemoveZoomPower).replace(".","")+"^"}_mapObject.map.getFlash().runFunction(CUSTOM_CTRL_MOVIE_PATH,"Redraw",tilesToRemoveStr,shapesToDrawList.join("~"));criticalSection--};var remoteLayerResponse=function(layer,requestId,tile,returnedShapesList){while(criticalSection>0)criticalSection++;if(isTileInTilesList(tile,mapsList[requestId].cacheTilesList.currentTiles)){mapsList[requestId].map.getFlash().runFunction(CUSTOM_CTRL_MOVIE_PATH,"Redraw","",returnedShapesList.join("~"))}criticalSection--};var onMapModified=function(_map){for(var i=0;i<mapsList.length;i++){if(mapsList[i].map==_map){draw(i,mapsList[i]);break;}}};t.addLayer=function(layer){if((t.layersList.length==0)&&(isInitialized)){for(var i=0;i<mapsList.length;i++){mapsList[i].map.addListener(Map.EVENT_MAP_MODIFIED,onMapModified,mapsList[i].map);}}var layerType=layer.getType();layer.addListener(Layer.EVENT_ADD_SHAPES,remoteLayerResponse,layer);layer.addListener(Layer.EVENT_LAYER_MODIFIED,onLayerModified,layer);layer.addListener(Layer.EVENT_SHAPE_MODIFIED,onShapeModified,layer);t.layersList.push(layer);layer.initParentParams(this,t.layersList.length-1)};t.showMeasureExLabels=function(){for(var i=0;i<mapsList.length;i++){mapsList[i].map.getFlash().runFunction(CUSTOM_CTRL_MOVIE_PATH,"ShowHideMeasureExLabels",true)}};t.hideMeasureExLabels=function(){for(var i=0;i<mapsList.length;i++){mapsList[i].map.getFlash().runFunction(CUSTOM_CTRL_MOVIE_PATH,"ShowHideMeasureExLabels",false)}};t.clearMeasureEx=function(){for(var i=0;i<mapsList.length;i++){mapsList[i].map.getFlash().runFunction(CUSTOM_CTRL_MOVIE_PATH,"ClearMeasureEx")}};t.parserArgs=function(evt,args){switch(evt){case LayersManager.EVENT_SHAPE_CLICK:argsList=args.split("~");mapObjctId=argsList[0]-0;for(var i=0;i<mapsList.length;i++){if(mapsList[i].map.objectId==mapObjctId){layerId=argsList[1];shapeId=argsList[2];var layersIndexes=layerId.split("^");layer=t.getLayerByIndex(layersIndexes);shape=layer.getShapeByIndex(shapeId);return new Array(mapsList[i].map,layer,shape)}}break;case LayersManager.EVENT_SHAPE_MOUSE_OVER:argsList=args.split("~");mapObjctId=argsList[0]-0;for(var i=0;i<mapsList.length;i++){if(mapsList[i].map.objectId==mapObjctId){layerId=argsList[1];shapeId=argsList[2];var layersIndexes=layerId.split("^");layer=t.getLayerByIndex(layersIndexes);shape=layer.getShapeByIndex(shapeId);return new Array(mapsList[i].map,layer,shape)}}break;case LayersManager.EVENT_SHAPE_MOUSE_OUT:argsList=args.split("~");mapObjctId=argsList[0]-0;for(var i=0;i<mapsList.length;i++){if(mapsList[i].map.objectId==mapObjctId){layerId=argsList[1];shapeId=argsList[2];var layersIndexes=layerId.split("^");layer=t.getLayerByIndex(layersIndexes);shape=layer.getShapeByIndex(shapeId);return new Array(mapsList[i].map,layer,shape)}}break;case LayersManager.EVENT_POLYGON_BUILD:var argsList=args.split("~");var mapObjctId=argsList[0]-0;var verticesList=argsList[1].split("^");var coordinatesList=new Array();for(var i=0;i<verticesList.length;i++){vertex=verticesList[i].split(",");coordinatesList.push(projector.createClientCoordinate(vertex[0],vertex[1]))}var polygon=new Polygon("Shape"+defaultLayerCounter,coordinatesList);defaultLayer.addShape(polygon);defaultLayerCounter++;polygon.redraw();return new Array(defaultLayer,polygon);break;case LayersManager.EVENT_POLYLINE_BUILD:var argsList=args.split("~");var mapObjctId=argsList[0]-0;var verticesList=argsList[1].split("^");var coordinatesList=new Array();for(var i=0;i<verticesList.length;i++){vertex=verticesList[i].split(",");coordinatesList.push(projector.createClientCoordinate(vertex[0],vertex[1]))}var polyline=new Polyline("Shape"+defaultLayerCounter,coordinatesList);defaultLayer.addShape(polyline);defaultLayerCounter++;polyline.redraw();return new Array(defaultLayer,polyline);break;case LayersManager.EVENT_CIRCLE_BUILD:var argsList=args.split("~");var mapObjctId=argsList[0]-0;var coordinate=argsList[1].split("^");var circle=new Circle("Shape"+defaultLayerCounter,projector.createClientCoordinate(coordinate[0],coordinate[1]),coordinate[2]);defaultLayer.addShape(circle);defaultLayerCounter++;circle.redraw();return new Array(defaultLayer,circle);break;case LayersManager.EVENT_SHAPE_EDITED:argsList=args.split("~");mapObjctId=argsList[0]-0;for(var i=0;i<mapsList.length;i++){if(mapsList[i].map.objectId==mapObjctId){layerId=argsList[1];shapeId=argsList[2];shapeInfo=argsList[3];var shapeInfoArr=shapeInfo.split("^");var layersIndexes=layerId.split("^");layer=t.getLayerByIndex(layersIndexes);shape=layer.getShapeByIndex(shapeId);shape.setCoordinate(new Coordinate(shapeInfoArr[0],shapeInfoArr[1]));shape.setRadius(shapeInfoArr[2]);}}case LayersManager.EVENT_SHAPE_SELECTED:var argsList=args.split("~");var shapesList=new Array();for(var i=1;i<argsList.length;i=i+3){layerId=argsList[i];shapeId=argsList[i+1];var layersIndexes=layerId.split("^");layer=t.getLayerByIndex(layersIndexes);shape=layer.getShapeByIndex(shapeId);shapesList.push({layer:layer,shape:shape});switch(shape.getType()){case Shape.POLYLINE:case Shape.POLYGON:shape.setVerticesString(null,true,argsList[i+2]);break;case Shape.CIRCLE:shape.setCoordinateString(argsList[i+2]);break;}}return new Array(shapesList);break;case LayersManager.EVENT_MEASURE_EX_START:var pos=args.split("~");return new Array(projector.createClientCoordinate(pos[1],pos[2]));break;case LayersManager.EVENT_MEASURE_EX_SEGMENT:var params=args.split("~");return new Array(params[1],projector.createClientCoordinate(params[2],params[3]),params[4]-0,params[5]);break;case LayersManager.EVENT_MEASURE_EX_END:var params=args.split("~");return new Array(params[1],params[2]);break;}return "";};var defaultLayer=t.createLocalVectorLayer("atlasDefaultLayer")};LayersManager.EVENT_SHAPE_CLICK="onshapeclick";LayersManager.EVENT_SHAPE_MOUSE_OVER="onshapemouseover";LayersManager.EVENT_SHAPE_MOUSE_OUT="onshapemouseout";LayersManager.EVENT_POLYGON_BUILD="onpolygonbuild";LayersManager.EVENT_POLYLINE_BUILD="onpolylinebuild";LayersManager.EVENT_CIRCLE_BUILD="oncirclebuild";LayersManager.EVENT_SHAPE_EDITED="onshapeedited";LayersManager.EVENT_SHAPE_SELECTED="onshapeselected";LayersManager.EVENT_MEASURE_EX_START="onmeasure_ex_start";LayersManager.EVENT_MEASURE_EX_SEGMENT="onmeasure_ex_segment";LayersManager.EVENT_MEASURE_EX_END="onmeasure_ex_end";function Shape(_id,_type,_label,_hint,_visible,_labelVisible){var t=this;var id=_id;var type=_type;var label=_label;var hint=_hint;var visible=_visible;var labelVisible=_labelVisible;t.parent=null;t.parentShapesListPos=null;t.parentRecord=null;t.toString=function(){return "shape"};t.updateShape=function(record,value,disallowRedraw){if(t.parent!=null){t.parent.updateShape(id,t.parentShapesListPos,record,value,disallowRedraw);}};t.initParentParams=function(_parent,_parentShapesListPos){t.parent=_parent;t.parentShapesListPos=_parentShapesListPos;};t.redraw=function(){if(t.parent!=null)t.parent.redrawShape(t.parentShapesListPos)};t.getId=function(){return id;};t.getType=function(){return type;};t.show=function(){visible=true;t.updateShape("visible",true)};t.hide=function(){visible=false;t.updateShape("visible",false)};t.isVisible=function(){return visible};t.moveBy=function(){if(t.parent!=null)t.updateShape("visible",false,[CUSTOM_CTRL_MOVIE_PATH,"ShowHideShape",t.parent.getName(),t.getId(),false])};t.setHint=function(_hint){hint=_hint;t.updateShape("hint",hint)};t.getHint=function(){return hint;};t.setLabel=function(_label){label=_label;t.updateShape("label",label)};t.getLabel=function(){return label;};t.showLabel=function(){labelVisible=true;t.updateShape("labelVisible",true)};t.hideLabel=function(){labelVisible=false;t.updateShape("labelVisible",false)};t.isLabelVisible=function(){return labelVisible}};Shape.MARKER="0";Shape.POLYGON="1";Shape.POLYLINE="2";Shape.CIRCLE="3";Marker.prototype=new Shape();function Marker(_id,_coordinate,_icon,_label,_hint,_visible,_labelVisible,_direction,_attributesList){if(_visible==null)_visible=true;if(_labelVisible==null)_labelVisible=true;this.Shape=Shape;this.Shape(_id,Shape.MARKER,_label,_hint,_visible,_labelVisible);var t=this;var coordinate=_coordinate;t.icon=_icon;t.direction=_direction;t.attributesList=_attributesList;t.toString=function(){return "marker"};t.setCoordinate=function(_coordinate){coordinate=_coordinate;t.updateShape("x",_coordinate.getMapX(),true);t.updateShape("y",_coordinate.getMapY())};t.getCoordinate=function(){return coordinate;};t.setIcon=function(_icon){t.icon=_icon;t.updateShape("icon",t.icon.getId())};t.getIcon=function(){return t.icon;};t.setDirection=function(_direction){t.direction=_direction;t.updateShape("direction",t.direction)};t.getDirection=function(){return t.direction;}};Poly.prototype=new Shape();function Poly(_id,_verticesList,_lineStyle,_label,_hint,_visible,_labelVisible){this.Shape=Shape;if(_visible==null)_visible=true;if(_labelVisible==null)_labelVisible=true;this.Shape(_id,Shape.POLYGON,_label,_hint,_visible,_labelVisible);var t=this;var verticesList=_verticesList;var verticesString=null;var lineStyle=_lineStyle;var bounds=null;t.toString=function(){return "poly"};t.getVerticesCount=function(){return verticesList.length};t.setVertexCoordinate=function(vertex,atIndex){verticesList[atIndex]=vertex;onVertexModified(atIndex)};t.getVertexCoordinate=function(vertexNumber){if(vertexNumber<verticesList.length){return verticesList[vertexNumber]}else{return null;}};t.insertVertex=function(vertex,atIndex){verticesList.splice(atIndex,0,vertex);onVertexModified()};t.addVertex=function(vertex){verticesList.push(vertex);onVertexModified(verticesList.length-1)};t.setVertices=function(_verticesList){verticesList=_verticesList;onVertexModified()};t.getVertices=function(){return verticesList};var onVertexModified=function(atIndex){t.setVerticesString();bounds=null;t.updateShape("verticesString",t.getVerticesString())};t.setVerticesString=function(atIndex,mapString,newVerticesString){if(mapString==true){verticesString=newVerticesString;bounds=null;verticesList.length=0;verticesList=new Array();var vertices=verticesString.split("^");var vertex;for(var i=0;i<vertices.length;i++){vertex=vertices[i].split(",");verticesList.push(projector.createClientCoordinate(vertex[0],vertex[1]))}t.updateShape("verticesString",verticesString,true)}else{if(atIndex==null){var stringArray=new Array();for(var i=0;i<verticesList.length;i++){stringArray.push(verticesList[i].getMapX()+","+verticesList[i].getMapY())}verticesString=stringArray.join("^")}else{var vertices=verticesString.split("^");vertices[atIndex]=verticesList[atIndex].getMapX()+","+verticesList[atIndex].getMapY();verticesString=vertices.join("^")}}};t.getVerticesString=function(){if(verticesString==null){t.setVerticesString()}return verticesString;};t.getBounds=function(){if(bounds==null){if(verticesList.length>0){var minX=verticesList[0].getMapX();var minY=verticesList[0].getMapY();;var maxX=minX;var maxY=minY;var x,y;for(var i=1;i<verticesList.length;i++){x=verticesList[i].getMapX();y=verticesList[i].getMapY();if(x<minX)minX=x;else if(x>maxX)maxX=x;if(y<minY)minY=y;else if(y>maxY)maxY=y;}var topLeft=projector.createClientCoordinate(minX,minY);var bottomRight=projector.createClientCoordinate(maxX,maxY);bounds=new MapBounds(topLeft,bottomRight)}}return bounds;};t.setLineStyle=function(_lineStyle){lineStyle=_lineStyle;t.updateShape("lineStyle",_lineStyle)};t.getLineStyle=function(){return lineStyle};t.toFlashString=function(){}};Polygon.prototype=new Poly();function Polygon(_id,_verticesList,_lineStyle,_brushStyle,_label,_hint,_visible,_labelVisible){this.Poly=Poly;if(_visible==null)_visible=true;if(_labelVisible==null)_labelVisible=true;this.Poly(_id,_verticesList,_lineStyle,_label,_hint,_visible,_labelVisible);var t=this;var brushStyle=_brushStyle;t.toString=function(){return "polygon"};t.setBrushStyle=function(_brushStyle){brushStyle=_brushStyle;t.updateShape("brushStyle",_brushStyle)};t.getBrushStyle=function(){return brushStyle};t.isPointInside=function(_point){numberOfIntersections=0;xPoint=_point.getMapX();yPoint=_point.getMapY();polygonPointsArr=t.getVertices();firstPoint=polygonPointsArr[0];for(var i=0;i<polygonPointsArr.length;i++){X1PolygonLine=polygonPointsArr[i].getMapX();Y1PolygonLine=polygonPointsArr[i].getMapY();if(i!=polygonPointsArr.length-1){X2PolygonLine=polygonPointsArr[i+1].getMapX();Y2PolygonLine=polygonPointsArr[i+1].getMapY();}else{X2PolygonLine=firstPoint.getMapX();Y2PolygonLine=firstPoint.getMapY();}aPolygonLine=(Y2PolygonLine-Y1PolygonLine)/(X2PolygonLine-X1PolygonLine);bPolygonLine=Y1PolygonLine-(aPolygonLine*X1PolygonLine);if(yPoint==(aPolygonLine*xPoint)+bPolygonLine){return true;}if(((yPoint>Y1PolygonLine)&&(yPoint<Y2PolygonLine))||((yPoint>Y2PolygonLine)&&(yPoint<Y1PolygonLine))){xIntersection=(yPoint-bPolygonLine)/aPolygonLine;if(xIntersection>xPoint)numberOfIntersections++;}}if(numberOfIntersections%2==1)return true;else return false;};t.toFlashString=function(){}};Polyline.prototype=new Poly();function Polyline(_id,_verticesList,_lineStyle,_label,_hint,_visible,_labelVisible){this.Poly=Poly;if(_visible==null)_visible=true;if(_labelVisible==null)_labelVisible=true;this.Poly(_id,_verticesList,_lineStyle,_label,_hint,_visible,_labelVisible);var t=this;t.toString=function(){return "polyline"}};Circle.prototype=new Shape();function Circle(_id,_coordinate,_radius,_lineStyle,_brushStyle,_label,_hint,_visible,_labelVisible){this.Shape=Shape;if(_visible==null)_visible=true;if(_labelVisible==null)_labelVisible=true;this.Shape(_id,Shape.CIRCLE,_label,_hint,_visible,_labelVisible);var t=this;var coordinate=_coordinate;var radius=_radius;var coordinateString=null;var lineStyle=_lineStyle;var brushStyle=_brushStyle;var bounds=null;t.toString=function(){return "circle"};t.setRadius=function(_radius){radius=_radius;coordinateString=null;onCircleModified()};t.getRadius=function(){return radius;};t.setCoordinate=function(_coordinate){coordinate=_coordinate;coordinateString=null;onCircleModified()};t.getCoordinate=function(){return coordinate;};var onCircleModified=function(atIndex){bounds=null;t.updateShape("coordinateString",t.getCoordinateString())};t.setCoordinateString=function(newCoordinateString){var paramsList=newCoordinateString.split("^");coordinate=projector.createClientCoordinate(paramsList[0],paramsList[1]);radius=paramsList[2]};t.getCoordinateString=function(){if(coordinateString==null){coordinateString=coordinate.getMapX()+"^"+coordinate.getMapY()+"^"+radius}return coordinateString;};t.getBounds=function(){if(bounds==null){var minX=coordinate.getMapX()-radius;var minY=coordinate.getMapY()-radius;var maxX=minX+2*radius;var maxY=minY+2*radius;var topLeft=projector.createClientCoordinate(minX,minY);var bottomRight=projector.createClientCoordinate(maxX,maxY);bounds=new MapBounds(topLeft,bottomRight)}return bounds;};t.setLineStyle=function(_lineStyle){lineStyle=_lineStyle;t.updateShape("lineStyle",_lineStyle)};t.getLineStyle=function(){return lineStyle};t.setBrushStyle=function(_brushStyle){brushStyle=_brushStyle;t.updateShape("brushStyle",_brushStyle)};t.getBrushStyle=function(){return brushStyle};t.isPointInside=function(_point){xPoint=_point.getMapX();yPoint=_point.getMapY();xCircle=coordinate.getMapX();yCircle=coordinate.getMapY();if((Math.pow((xCircle-xPoint),2)+Math.pow((yCircle-yPoint),2))<(Math.pow(radius,2)))return true;else return false;}};Icon.objectId=0;var iconsList=new Array();function Icon(isInheritance){var t=this;t.objectId=Icon.objectId;Icon.objectId++;var offsetPosition=new ScreenCoordinate(0,0);var counterEnabled=false;var counterColor="FFFFFF";var counterSize="13";var counterOffset=new ScreenCoordinate(0,0);t.toString=function(){return "icon"};t.getId=function(){return t.objectId;};t.addIconToFlash=function(){var flash;for(var i=0;i<holdFlashObjectsArr.length;i++){flash=holdFlashObjectsArr[i].getFlash();flash.runFunction.apply(this,arguments)}iconsList.push(arguments)};t.setOffsetPosition=function(_offsetPosition){offsetPosition=_offsetPosition;updateIcon();};t.getOffsetPosition=function(){return offsetPosition;};var updateIcon=function(){t.addIconToFlash(CUSTOM_CTRL_MOVIE_PATH,"UpdateIcon",t.objectId,offsetPosition.x,offsetPosition.y,counterEnabled,counterSize,counterColor,counterOffset.x,counterOffset.y)};t.enableCounter=function(){counterEnabled=true;updateIcon();};t.disableCounter=function(){counterEnabled=false;updateIcon();};t.setCounterSize=function(_counterSize){counterSize=_counterSize;updateIcon();};t.getCounterSize=function(){return counterSize;};t.setCounterColor=function(_counterColor){counterColor=_counterColor;updateIcon();};t.getCounterColor=function(){return counterColor;};t.setCounterOffset=function(_counterOffset){counterOffset=_counterOffset;updateIcon();};t.getCounterOffset=function(){return counterOffset;};if(isInheritance!=true){var lineStyle=new LineStyle(1,"0D263E",100);var brushStyle=new BrushStyle("184A7C",100);var radius=5;t.addIconToFlash(CUSTOM_CTRL_MOVIE_PATH,"AddIcon","2",t.objectId,radius,lineStyle.width,lineStyle.color,lineStyle.alpha,brushStyle.color,brushStyle.alpha)}};function ExternalIcon(_path){this.Icon=Icon;this.Icon(true);var t=this;var path=_path;t.addIconToFlash(CUSTOM_CTRL_MOVIE_PATH,"AddIcon","0",t.objectId,path);t.toString=function(){return "externalIcon"};t.setPath=function(_path){path=_path;t.addIconToFlash(CUSTOM_CTRL_MOVIE_PATH,"AddIcon","0",t.objectId,path)};t.getPath=function(){return path;}};function RectangleIcon(_radius,_lineStyle,_brushStyle){this.Icon=Icon;this.Icon(true);var t=this;var radius=_radius;var lineStyle=_lineStyle;var brushStyle=_brushStyle;t.addIconToFlash(CUSTOM_CTRL_MOVIE_PATH,"AddIcon","1",t.objectId,radius,lineStyle.width,lineStyle.color,lineStyle.alpha,brushStyle.color,brushStyle.alpha);t.toString=function(){return "externalIcon"}};function CircleIcon(_radius,_lineStyle,_brushStyle){this.Icon=Icon;this.Icon(true);var t=this;var radius=_radius;var lineStyle=_lineStyle;var brushStyle=_brushStyle;t.addIconToFlash(CUSTOM_CTRL_MOVIE_PATH,"AddIcon","2",t.objectId,radius,lineStyle.width,lineStyle.color,lineStyle.alpha,brushStyle.color,brushStyle.alpha);t.toString=function(){return "externalIcon"}};function Overlay(_Name){var t=this;var name=_Name;var domElement=null;var html=null;var offsetPosition=new ScreenCoordinate(0,0);t.parent=null;t.parentArrPos=null;t.parentRecord=null;t.toString=function(){return "overlay"};t.setName=function(_name){name=_name};t.getName=function(){return name;};t.setDomElement=function(_domElement){domElement=_domElement};t.getDomElement=function(){return domElement};t.setHtml=function(_html){var domElement=document.createElement('div');oNewNode.setAttribute('id',"bvbbbb");domElement.style.position="absolute";domElement.style.top="0px";domElement.style.left="0px";oNewNode.innerText=_html;ni.appendChild(oNewNode);html=_html;domElement=null};t.getHtml=function(){return html};t.setOffsetPosition=function(_offsetPosition){offsetPosition=_offsetPosition};t.getOffsetPosition=function(){return offsetPosition;};t.close=function(){}};HtmlOverlay=Overlay;;function TileOverlay(_Name,_Img,_Bounds){var t=this;var name=_Name;var domElement=null;var imgUrl=_Img;var bounds=_Bounds;var coordinateLeftUp=_Bounds.topLeft;var coordinateRightDown=_Bounds.bottomRight;t.parent=null;t.parentArrPos=null;t.parentRecord=null;t.toString=function(){return "tileoverlay"};t.setName=function(_name){name=_name};t.getName=function(){return name;};t.setDomElement=function(_domElement){domElement=_domElement};t.getDomElement=function(){return domElement};t.getImgUrl=function(){return imgUrl;};t.getBounds=function(){return bounds;};t.getLeftUpCoordinate=function(){return coordinateLeftUp;};t.getRightDownCoordinate=function(){return coordinateRightDown;}};HtmlTileOverlay=TileOverlay;;Map.prototype=new EventListener();function Map(width,height,_initializeObject,_initializeZoomLevel){this.EventListener=EventListener;this.EventListener();var t=this;width+="";height+="";t.width=width.replace("%","%25");t.height=height.replace("%","%25");t.projection="";t.bgColor="EAEADB";var flash=new Flash();var overlaysListMap=new Array();var overlaysListScreen=new Array();var ScreenOverlayZIndex=1000;var MapOverlayZIndex=0;var contextMenu=null;t.layersManager=new LayersManager();var waitingOverlay=null;var allowPanning=true;var allowMouseWheelZooming=true;var allowClickPanning=true;var allowSmoothPanning=true;var allowSmoothZooming=true;var allowSmoothLoading=true;var grayScale=false;var allowContinuePanning=false;var tilesLoadingSensitive=40;t.isMapInitialized=false;t.isMapFirstLoaded=false;var units=Map.UNIT_METRIC;var addressZoomLevel=null;holdFlashObjectsArr.push(this);if(iconsList.length>0){for(i=0;i<iconsList.length;i++){flash.runFunction.apply(this,iconsList[i])}iconsList.length=0}var geocode=new Geocode();var search=new Search();var route=null;t.routeVectorLayer=new RouteVectorLayer(this);var startXMouseJSPos=0;var startYMouseJSPos=0;var isMouseJSClick=false;t.addFlashEvent=true;this.flashCallBackEvent=function(evt,args){t.triggerEvent(evt,args)};flashListener.addListener(t.objectId,this.flashCallBackEvent,Flash.EVENT_FLASH_INITIALIZE);flashListener.addListener(t.objectId,this.flashCallBackEvent,Map.EVENT_MAP_INITIALIZE);flashListener.addListener(t.objectId,this.flashCallBackEvent,Map.EVENT_MAP_LOADED);flashListener.addListener(t.objectId,this.flashCallBackEvent,Flash.EVENT_FLASH_MOUSE_OUT);flashListener.addListener(t.objectId,this.flashCallBackEvent,Flash.EVENT_FLASH_MOUSE_WHEEL);flashListener.addListener(t.objectId,this.flashCallBackEvent,Map.EVENT_MAP_DRAG_JS);flashListener.addListener(t.objectId,this.flashCallBackEvent,Map.EVENT_MAP_ZOOM_JS);flashListener.addListener(t.objectId,this.flashCallBackEvent,Map.EVENT_MAP_RESIZE);flashListener.addListener(t.objectId,this.flashCallBackEvent,Map.EVENT_CUSTOM_CTRL_LOADED);flashListener.addListener(t.objectId,this.flashCallBackEvent,Map.EVENT_CONTEXT_MENU_ITEM_CLICK);flashListener.addListener(t.objectId,this.flashCallBackEvent,Map.EVENT_ROUTE_CHANGED);flashListener.addListener(t.objectId,this.flashCallBackEvent,Map.EVENT_ROUTE_LOCATION_CHANGED);flashListener.addListener(t.objectId,this.flashCallBackEvent,Map.EVENT_FLASH_ROUTE_LOADED);flashListener.addListener(t.objectId,this.flashCallBackEvent,Map.EVENT_FLASH_ROUTE_LOADED);flashListener.addListener(t.objectId,this.flashCallBackEvent,Map.EVENT_FLASH_OVERLAY_LOADED);flashListener.addListener(t.objectId,this.flashCallBackEvent,Map.EVENT_UNLOAD_ADVERTISEMENT);flashListener.addListener(t.objectId,this.flashCallBackEvent,Map.EVENT_LOAD_ADVERTISEMENT);var doMapInitialize;var initializeObject=null;var initializeZoomLevel=null;if(_initializeObject!=null){if((_initializeObject.type=="coordinate")||(_initializeObject.type=="address")||(_initializeObject.type=="route")){initializeObject=_initializeObject;initializeZoomLevel=_initializeZoomLevel;doMapInitialize=false}else{doMapInitialize=true}}else doMapInitialize=true;t.aaaaaa=function(X1,Y1,X2,Y2,i){flash.runFunction("","DrawRect22",X1,Y1,X2,Y2,i)};t.toString=function(){return "map"};t.writeMap=function(){holdFlashObjectsArrCount++;this.flashId="AtlasMap"+holdFlashObjectsArrCount;var c=clientSettings;flash.init(this.flashId,this.width,this.height,c.swfSource,this.bgColor,true,this.objectId);flash.allowRunFunction=false;flash.addArg("Server",c.server);flash.addArg("Dll",c.dll);flash.addArg("customCtrl",c.customCtrl);flash.addArg("MapWidth",t.width);flash.addArg("MapHeight",t.height);flash.addArg("FlashId",t.objectId);flash.addArg("UD",c.UD);flash.addArg("SessionId",c.sessionId);flash.addArg("MapVersion",c.mapVer);flash.addArg("GuiLang",c.guiLang);flash.addArg("MapUnits",units);flash.writeFlash()};t.writeMapTo=function(div){holdFlashObjectsArrCount++;this.flashId="AtlasMap"+holdFlashObjectsArrCount;var c=clientSettings;flash.init(this.flashId,this.width,this.height,c.swfSource,this.bgColor,true,this.objectId);flash.allowRunFunction=false;flash.addArg("Server",c.server);flash.addArg("Dll",c.dll);flash.addArg("customCtrl",c.customCtrl);flash.addArg("MapWidth",t.width);flash.addArg("MapHeight",t.height);flash.addArg("FlashId",t.objectId);flash.addArg("UD",c.UD);flash.addArg("SessionId",c.sessionId);flash.addArg("MapVersion",c.mapVer);flash.addArg("GuiLang",c.guiLang);flash.addArg("MapUnits",units);flash.writeFlashTo(div)};t.writeMapToContainer=t.writeMapTo;t.getFlash=function(){return flash;};t.getContainer=function(){return flash.getContainer();};t.setBgColor=function(bgColor){if((bgColor=="")||(bgColor==null))bgColor="EAEADB";this.bgColor=bgColor;var div=document.getElementById("Div"+this.flashId);if(div!=null)div.style.backgroundColor=this.bgColor};t.getBgColor=function(){return this.bgColor};t.enablePanning=function(){allowPanning=true;setMapSettings();};t.disablePanning=function(){allowPanning=false;setMapSettings();};t.enableGrayScale=function(){grayScale=true;setMapSettings();};t.disableGrayScale=function(){grayScale=false;setMapSettings();};t.enableContinuePanning=function(){allowContinuePanning=true;setMapSettings();};t.disableContinuePanning=function(){allowContinuePanning=false;setMapSettings();};t.isPanningEnabled=function(){return allowPanning;};t.enableMouseWheelZooming=function(){allowMouseWheelZooming=true;setMapSettings();};t.disableMouseWheelZooming=function(){allowMouseWheelZooming=false;setMapSettings();};t.isMouseWheelZoomingEnabled=function(){return allowMouseWheelZooming;};t.enableClickPanning=function(){allowClickPanning=true;setMapSettings();};t.disableClickPanning=function(){allowClickPanning=false;setMapSettings();};t.isClickPanningEnabled=function(){return allowClickPanning;};t.enableSmoothLoading=function(){allowSmoothLoading=true;setMapSettings();};t.disableSmoothLoading=function(){allowSmoothLoading=false;setMapSettings();};t.isSmoothLoadingEnabled=function(){return allowSmoothLoading;};t.enableSmoothPanning=function(){allowSmoothPanning=true};t.disableSmoothPanning=function(){allowSmoothPanning=false};t.isSmoothPanningEnabled=function(){return allowSmoothPanning;};t.enableSmoothZooming=function(){allowSmoothZooming=true};t.disableSmoothZooming=function(){allowSmoothZooming=false};t.isSmoothZoomingEnabled=function(){return allowSmoothZooming;};t.setTilesLoadingSensitive=function(_TilesLoadingSensitive){tilesLoadingSensitive=_TilesLoadingSensitive};t.getTilesLoadingSensitive=function(){return tilesLoadingSensitive;};var setMapSettings=function(){flash.runFunction("","SetMapSettings",allowPanning,allowMouseWheelZooming,allowClickPanning,allowSmoothLoading,tilesLoadingSensitive,grayScale,allowContinuePanning)};t.assignSettingsFrom=function(_map){allowPanning=_map.isPanningEnabled();allowMouseWheelZooming=_map.isMouseWheelZoomingEnabled();allowClickPanning=_map.isClickPanningEnabled();allowSmoothPanning=_map.isSmoothPanningEnabled();allowSmoothZooming=_map.isSmoothZoomingEnabled();allowSmoothLoading=_map.isSmoothLoadingEnabled();tilesLoadingSensitive=_map.getTilesLoadingSensitive();setMapSettings();};t.setContextMenu=function(newContextMenu){contextMenu=newContextMenu;var itemsList=contextMenu.getItemsList();for(var i=itemsList.length-1;i>=0;i--){flash.runFunction("","addContextMenuItem",itemsList[i].caption,itemsList[i].separatorBefore)}};t.getContextMenu=function(){return contextMenu;};t.setSize=function(mapSize){var div=document.getElementById("Div"+flash.id);var width=mapSize.width+"";var height=mapSize.height+"";var width=width.replace("%25","%");var height=height.replace("%25","%");if(width.indexOf("%")== -1){width+="px";flash.object.style.width=width}if(height.indexOf("%")== -1){height+="px";flash.object.style.height=height}div.style.width=width;div.style.height=height};t.getSize=function(){return new MapSize(flash.getVariable("MapWidth"),flash.getVariable("MapHeight"))};t.setGuiLang=function(guiLang){flash.runFunction("","setGuiLang",guiLang)};t.setUnits=function(_units){units=_units;flash.runFunction("","setMapUnits",units)};t.getUnits=function(){return units};count=0;t.setProjection=function(newProjection){if(newProjection!=t.getProjection()){var centerPos=t.getCenterPosition();var lat=centerPos.getLat();var long=centerPos.getLong();mapCoordSystem=newProjection;projector.setDefaultProjections(clientCoordSystem,mapCoordSystem);var point=new LatLong(lat,long);t.projection=newProjection;flash.runFunction("","setMapProjection",newProjection)}};t.getProjection=function(){return flash.getVariable("MapProjection")};t.setOnLoadMovie=function(milliseconds,URL,screenCoordinate){flash.runFunction("","setAdvertisementLayer",milliseconds,URL,screenCoordinate.x,screenCoordinate.y);};t.skipOnLoadMovie=function(){flash.runFunction("","clearAdvertisementLayer");};t.setMode=function(mode){flash.runFunction("","setMode",mode)};t.getMode=function(){return flash.getVariable("MapMode")};t.setView=function(view){flash.runFunction("","ChangeView",view)};t.getView=function(){return flash.getVariable("MapView")};t.MoveByCoords=function(deltaX,deltaY){flash.runFunction("","MoveByCoords",deltaX,deltaY)};t.panBy=function(deltaX,deltaY){if(allowSmoothPanning){flash.runFunction("","SmoothBy",deltaX,deltaY)}else{flash.runFunction("","MoveBy",deltaX,deltaY)}};t.redoPosition=function(){flash.runFunction("","redoPosition")};t.undoPosition=function(){flash.runFunction("","undoPosition")};t.zoomIn=function(){if(allowSmoothZooming){flash.runFunction("","SmoothZoomIn")}else{flash.runFunction("","ZoomIn")}};t.zoomOut=function(){if(allowSmoothZooming){flash.runFunction("","SmoothZoomOut")}else{flash.runFunction("","ZoomOut")}};t.setMinZoomLevel=function(zoomLevel){flash.setVariable("MinZoomPower",Math.pow(2,zoomLevel))};t.getMinZoomLevel=function(){return Math.log(flash.getVariable("MinZoomPower"))/Math.log(2)};t.setMaxZoomLevel=function(zoomLevel){flash.setVariable("MaxZoomPower",Math.pow(2,zoomLevel))};t.getMaxZoomLevel=function(){return Math.log(flash.getVariable("MaxZoomPower"))/Math.log(2)};t.setZoomLevel=function(zoomLevel){flash.runFunction("","SetZoom",zoomLevel)};t.getZoomLevel=function(){return Math.round(Math.log(flash.getVariable("ZoomPower"))/Math.log(2))};t.getZoomPower=function(){return flash.getVariable("ZoomPower")-0};t.mapToClient=function(coordinate){var mapSize=t.getSize();var zoomPower=flash.getVariable("ZoomPower")-0;var centerPosition=t.getCenterPosition();return new ScreenCoordinate(Math.round(((coordinate.getMapX()-centerPosition.getMapX())*zoomPower)+mapSize.width/2),Math.round(((coordinate.getMapY()-centerPosition.getMapY())*zoomPower)+mapSize.height/2))};t.clientToMap=function(screenCoordinate){var coordinate=t.getCenterPosition();var mapSize=t.getSize();var zoomPower=flash.getVariable("ZoomPower")-0;return projector.createClientCoordinate(coordinate.getMapX()-Math.round((mapSize.width/2-screenCoordinate.x)/zoomPower),coordinate.getMapY()-Math.round((mapSize.height/2-screenCoordinate.y)/zoomPower))};t.isInsideClientView=function(coordinate){var CVP=t.getClientViewPosition();var coordinateMapX=coordinate.getMapX();var coordinateMapY=coordinate.getMapY();if((coordinateMapX>=CVP.topLeft.getMapX())&&(coordinateMapY>=CVP.topLeft.getMapY())&&(coordinateMapX<=CVP.bottomRight.getMapX())&&(coordinateMapY<=CVP.bottomRight.getMapY()))return true;else return false};t.getClientViewPosition=function(){var iLeft,iTop,iRight,iBottom;var centerCoordinate=t.getCenterPosition();var mapSize=t.getSize();var zoomPower=flash.getVariable("ZoomPower")-0;iLeft=(centerCoordinate.getMapX())-(mapSize.width/2/zoomPower);iTop=(centerCoordinate.getMapY())-(mapSize.height/2/zoomPower);iRight=(centerCoordinate.getMapX())+(mapSize.width/2/zoomPower);iBottom=(centerCoordinate.getMapY())+(mapSize.height/2/zoomPower);var topLeft=projector.createClientCoordinate(iLeft,iTop);var bottomRight=projector.createClientCoordinate(iRight,iBottom);return new MapBounds(topLeft,bottomRight)};t.getBounds=function(){var iLeft,iTop,iRight,iBottom;var centerCoordinate=t.getCenterPosition();var mapSize=t.getSize();var zoomPower=flash.getVariable("ZoomPower")-0;iLeft=flash.getVariable("MapBoundLeft")-0;iTop=flash.getVariable("MapBoundTop")-0;iRight=flash.getVariable("MapBoundRight")-0;iBottom=flash.getVariable("MapBoundBottom")-0;var topLeft=projector.createClientCoordinate(iLeft,iTop);var bottomRight=projector.createClientCoordinate(iRight,iBottom);return new MapBounds(topLeft,bottomRight)};t.setCenterPosition=function(_object,zoomLevelOrSettingsRequest,countryCodeOrSettingsRequest){if(t.isMapInitialized){switch(_object.type){case "address":geocode.addListener(Geocode.EVENT_GEO_RESULT,onGeoResult,geocode);if(arguments.length>2){geocode.addressToCoordinate(_object,countryCodeOrSettingsRequest)}else{geocode.addressToCoordinate(_object)}if(zoomLevelOrSettingsRequest=="")addressZoomLevel=null;else addressZoomLevel=zoomLevelOrSettingsRequest;break;case "coordinate":if(zoomLevelOrSettingsRequest==null)zoomLevelOrSettingsRequest=t.getZoomLevel();flash.runFunction("","SetMapPosition",_object.getMapX(),_object.getMapY(),Math.pow(2,zoomLevelOrSettingsRequest));break;case "route":route=_object;route.addListener(Route.EVENT_ROUTE_RESULT,onRouteResult,route);if(arguments.length>2){route.execute(countryCodeOrSettingsRequest)}else{route.execute()}break;case "searchrequest":search.addListener(Search.EVENT_SEARCH_DISPLAY_RESULT,onSearchResult,search);if(arguments.length>1)search.find(_object,zoomLevelOrSettingsRequest,true,this);else search.find(_object,"",true,this);break;}}else{if(_object!=null){if((_object.type=="coordinate")||(_object.type=="address")||(_object.type=="route")||(_object.type=="searchrequest")){initializeObject=_object;initializeZoomLevel=zoomLevelOrSettingsRequest;doMapInitialize=false}else{doMapInitialize=true}}else doMapInitialize=true}};t.setCenterPositionByIP=function(ip){geocode.addListener(Geocode.EVENT_GEO_RESULT,onGeoIPResult,geocode);if(ip==null)ip="";geocode.ipToCoordinate(ip);};t.getCenterPosition=function(){return projector.createClientCoordinate(Math.round(flash.getVariable("HorzPos")),Math.round(flash.getVariable("VertPos")))};t.fitToRoute=function(){if(route!=null){t.setCenterPosition(route.centerCoordinate,route.zoomLevel)}};var getLayerCoordinates=function(layer){switch(layer.toString()){case "localVectorLayer":var shapesList=layer.getShapes();var coordinatesList=new Array();var coords;for(var i=0;i<shapesList.length;i++){coords=getShapeCoordinates(shapesList[i]);coordinatesList=coordinatesList.concat(coords)}return coordinatesList;break;case "layersCollection":var layersList=layer.getLayers();var coordinatesList=new Array();var coords;for(var i=0;i<layersList.length;i++){coords=getLayerCoordinates(layersList[i]);coordinatesList=coordinatesList.concat(coords)}return coordinatesList;break;}};var getShapeCoordinates=function(shape){var coordinatesList=null;switch(shape.toString()){case "marker":coordinatesList=new Array(shape.getCoordinate());break;case "polygon":coordinatesList=shape.getVertices();break;case "polyline":coordinatesList=shape.getVertices();break;case "circle":var bounds=shape.getBounds();coordinatesList=new Array(bounds.topLeft,bounds.bottomRight);break;}return coordinatesList;};t.fitMap=function(_object){var coordinatesList=null;if(_object.length){coordinatesList=_object}else{switch(_object.toString()){case "marker":case "polygon":case "polyline":case "circle":coordinatesList=getShapeCoordinates(_object);break;case "localVectorLayer":case "layersCollection":coordinatesList=getLayerCoordinates(_object);break;}}if(coordinatesList!=null){if(coordinatesList[0].type=="coordinate"){var PosX=coordinatesList[0].getMapX()-0;var PosY=coordinatesList[0].getMapY()-0;var minX=PosX;var minY=PosY;var maxX=PosX;var maxY=PosY;}for(var i=1;i<coordinatesList.length;i++){if(coordinatesList[0].type=="coordinate"){var PosX=coordinatesList[i].getMapX()-0;var PosY=coordinatesList[i].getMapY()-0;if(PosX<minX)minX=PosX;else if(PosX>maxX)maxX=PosX;if(PosY<minY)minY=PosY;else if(PosY>maxY)maxY=PosY}}if(minX!=null){var deltaX=Math.abs(maxX-minX);var deltaY=Math.abs(maxY-minY);var zoomPower;if((deltaX==0)||(deltaY==0)){if((deltaX==0)&&(deltaY==0)){zoomPower=1;}else{if(deltaX==0)zoomPower=t.height/deltaY;else zoomPower=t.width/deltaX}}else{zoomPower=Math.min(t.width/deltaX,t.height/deltaY)}if(zoomPower>=1)zoomPower=1;var zoomLevel=zoomPowerToLevel(zoomPower);t.setCenterPosition(new Coordinate((minX+maxX)/2,(minY+maxY)/2),zoomLevel)}}};var zoomPowerToLevel=function(zoomPower){var ZL=0;if(zoomPower==1)return 0;if(zoomPower<1){var Z=1;while(zoomPower-0<Z){Z=Z/2;ZL=ZL-1;}}else{var Z=1;while(zoomPower-0>Z){Z=Z*2;ZL=ZL+1;}}return ZL;};t.showRoute=function(_object,countryCodeOrSettingsRequest){if(_object.type=="route"){if(route!=_object){route=_object;route.addListener(Route.EVENT_ROUTE_RESULT,onRouteResult,route);}if(arguments.length>1){route.execute(countryCodeOrSettingsRequest)}else{route.execute()}}};t.clearRoute=function(){if(route!=null){route=null;t.routeVectorLayer.clearRoute();}};t.clearSearch=function(){if(search.layersearchResultsFlag)layersearchResults.removeAll();search.layersearchResultsFlag=false;};var onGeoResult=function(object,geocode){if((geocode.resultCode==1)||(geocode.resultCode== -1)){if(addressZoomLevel==null)addressZoomLevel=geocode.geoResult.zoomLevel;t.showTargetIcon(geocode.geoResult.coordinate);t.setCenterPosition(geocode.geoResult.coordinate,addressZoomLevel,true)}else{if(!t.isMapFirstLoaded)flash.runFunction("","DoFirstLoad")}t.triggerEvent(Map.EVENT_GEO_RESULT,geocode)};var onGeoIPResult=function(object,geocode){if((geocode.resultCode==1)||(geocode.resultCode== -1)){if(geocode.geoResult.zoomLevel>= -3)t.showTargetIcon(geocode.geoResult.coordinate);t.setCenterPosition(geocode.geoResult.coordinate,geocode.geoResult.zoomLevel);}else{if(!t.isMapFirstLoaded)flash.runFunction("","DoFirstLoad")}t.triggerEvent(Map.EVENT_GEO_RESULT,geocode);};var onSearchResult=function(object,search){t.triggerEvent(Map.EVENT_SEARCH_RESULT,search)};var onRouteResult=function(){if(route.lastProcessRouteId==route.currentProcessRouteId){if(route.resultCode==1){t.routeVectorLayer.init(route,t);t.setCenterPosition(route.centerCoordinate,route.zoomLevel)}}};t.showTargetIcon=function(_coordinate){flash.runFunction("","showTargetIcon",_coordinate.getMapX(),_coordinate.getMapY())};t.hideTargetIcon=function(){flash.runFunction("","hideTargetIcon")};t.setTargetIcon=function(path,posX,posY){flash.runFunction("","setTargetIcon",path,posX,posY)};t.hideCursor=function(){flash.runFunction("","HideCursor")};t.setCursor=function(url){flash.runFunction("","setMouseCursor",url)};t.setCursorToDefault=function(){flash.runFunction("","setCursorToDefault")};t.setDefaultCursor=function(){flash.runFunction("","setDefaultCursor",url)};t.showWaitingOverlay=function(){if(waitingOverlay==null){waitingOverlay=new Overlay("waitingOverlay");var _div=document.createElement('div');_div.style.width="140px";_div.style.height="140px";var flashWaitingOverlay=new Flash();flashWaitingOverlay.init("WaitingOverlay","140","140","WaitingOverlay.swf","",true,"");_div.innerHTML=flashWaitingOverlay.getHtmlFlashTag();waitingOverlay.setDomElement(_div);waitingOverlay.setOffsetPosition(new ScreenCoordinate(-60,-60))}t.addOverlayToScreen(waitingOverlay,Map.ALIGN_CENTER_CENTER,new ScreenCoordinate(0,0))};t.hideWaitingOverlay=function(){t.removeOverlay(waitingOverlay.getName())};var setDomElementScreenPos=function(domElement,offsetPosition,_anchor,screenCoordinate){domElement.style.position="absolute";if(screenCoordinate==null){var x=0;var y=0}else{var x=screenCoordinate.x;var y=screenCoordinate.y}x=x-offsetPosition.x;y=y-offsetPosition.y;switch(_anchor){case Map.ALIGN_TOP_LEFT:break;case Map.ALIGN_TOP_CENTER:x=t.width/2-x;break;case Map.ALIGN_TOP_RIGHT:x=t.width-x;break;case Map.ALIGN_CENTER_LEFT:y=t.height/2-y;break;case Map.ALIGN_CENTER_CENTER:x=t.width/2-x;y=t.height/2-y;break;case Map.ALIGN_CENTER_RIGHT:x=t.width-x;y=t.height/2-y;break;case Map.ALIGN_BOTTOM_LEFT:y=t.height-y;break;case Map.ALIGN_BOTTOM_CENTER:x=t.width/2-x;y=t.height-y;break;case Map.ALIGN_BOTTOM_RIGHT:x=t.width-x;y=t.height-y;break;}domElement.style.top=y+"px";domElement.style.left=x+"px";};var FlashOverlay=function(x,y,path,name,depth){this.x=x;this.y=y;this.path=path;this.name=name;this.depth=depth};var flashScreenOverlayList=new Array();var flashMapOverlayList=new Array();t.addFlashOverlayToScreen=function(x,y,path,name,depth){flash.runFunction("","LoadExternalStaticLayer",x,y,path,name,depth)};t.addFlashOverlayToMap=function(x,y,path,name,depth){flash.runFunction("","LoadExternalDynamicLayers",x,y,path,name,depth)};t.removeFlashOverlayFromMap=function(name){flash.runFunction("","RemoveExternalDynamicLayer",name)};t.addFlashComponentToMap=function(x,y,flashOverlay,depth){flashMapOverlayList.push(flashOverlay);flashOverlay.setParentMap(t);t.addFlashOverlayToMap(0,0,flashOverlay.getPath(),flashOverlay.getName())};t.removeFlashComponentFromMap=function(flashOverlay){var length=flashMapOverlayList.length;for(var i=0;i<length;i++){if(flashMapOverlayList[i].getName()==flashOverlay.getName()){if(length>1){flashMapOverlayList[i]=flashMapOverlayList[length-1];flashMapOverlayList.length--}else{flashMapOverlayList.length=0;}break;}}t.removeFlashOverlayFromMap(flashOverlay.getName())};t.addOverlayToScreen=function(overlay,_anchor,screenCoordinate,zIndex){var container=t.getContainer();var domElement=overlay.getDomElement();var offsetPosition=overlay.getOffsetPosition();setDomElementScreenPos(domElement,offsetPosition,_anchor,screenCoordinate);domElement.style.display='';if(zIndex!=null)ScreenOverlayZIndex=1000+zIndex;domElement.style.zIndex=ScreenOverlayZIndex;ScreenOverlayZIndex++;container.appendChild(domElement);overlaysListScreen.push(new Array(overlay,_anchor,screenCoordinate))};t.setOverlayScreenCoordinate=function(_overlay,_anchor,screenCoordinate){if(_overlay.toString().toLowerCase()=="overlay"){}else{_overlay=t.getOverlay(overlayName)}for(var i=0;i<overlaysListScreen.length;i++){if(overlaysListScreen[i][0]==_overlay){setDomElementScreenPos(_overlay.getDomElement(),_overlay.getOffsetPosition(),_anchor,screenCoordinate);overlaysListScreen[i][1]=_anchor;overlaysListScreen[i][2]=screenCoordinate;break;}}};t.setScreenOverlayPosition=t.setOverlayScreenCoordinate;t.setOverlayMapCoordinate=function(_overlay,_mapCoordinate){for(var i=0;i<overlaysListMap.length;i++){if(overlaysListMap[i][0]==_overlay){var screenCoordinate=t.mapToClient(_mapCoordinate);if(screenCoordinate==null){var x=0;var y=0}else{var x=screenCoordinate.x;var y=screenCoordinate.y}x=x+Math.round(overlaysListMap[i][3]);y=y+Math.round(overlaysListMap[i][4]);var domElement=_overlay.getDomElement();domElement.style.top=y+"px";domElement.style.left=x+"px";overlaysListMap[i][1]=_mapCoordinate.getMapX()-0;overlaysListMap[i][2]=_mapCoordinate.getMapY()-0;break;}}};t.setMapOverlayCoordinate=t.setOverlayMapCoordinate;t.showOverlay=function(overlayName){var overlay=t.getOverlay(overlayName);if(overlay!=null){var domElement=overlay.getDomElement();domElement.style.display=''}};t.hideOverlay=function(overlayName){var overlay=t.getOverlay(overlayName);if(overlay!=null){var domElement=overlay.getDomElement();domElement.style.display='none'}};t.isOverlayVisible=function(overlayName){var overlay=t.getOverlay(overlayName);if(overlay!=null){var domElement=overlay.getDomElement();if(domElement.style.display=="")return true;else return false;}else return false;};t.addOverlayToMap=function(overlay,mapCoordinate,centerMap,zIndex){var container=t.getContainer();var domElement=overlay.getDomElement();var offsetPosition=overlay.getOffsetPosition();domElement.style.position="absolute";var screenCoordinate=t.mapToClient(mapCoordinate);if(screenCoordinate==null){var x=0;var y=0}else{var x=screenCoordinate.x;var y=screenCoordinate.y}x=x+Math.round(offsetPosition.x);y=y+Math.round(offsetPosition.y);domElement.style.top=y+"px";domElement.style.left=x+"px";domElement.style.display='';if(zIndex!=null)domElement.style.zIndex=zIndex;for(var i=0;i<overlaysListMap.length;i++){if(overlaysListMap[i][0]!=null){if(overlaysListMap[i][0].getDomElement()==overlay.getDomElement()){overlaysListMap[i][1]=mapCoordinate.getMapX()-0;overlaysListMap[i][2]=mapCoordinate.getMapY()-0;overlaysListMap[i][3]=offsetPosition.x;overlaysListMap[i][4]=offsetPosition.y;overlaysListMap[i][5]="0";return false;}}}if(overlaysListMap.length==0){flash.runFunction("","SetJSMapMove",true)}container.appendChild(domElement);overlaysListMap.push(new Array(overlay,mapCoordinate.getMapX(),mapCoordinate.getMapY(),offsetPosition.x,offsetPosition.y,"0"));if(centerMap){var d=domElement;var top=parseInt(d.style.top);var left=parseInt(d.style.left);var mapX=mapCoordinate.getMapX()-0;var mapY=mapCoordinate.getMapY()-0;var horzPos=flash.getVariable("HorzPos")-0;var vertPos=flash.getVariable("VertPos")-0;var zoomPower=flash.getVariable("LiveZoomPower")-0;if((top<0)||(left<0)||(left+d.offsetWidth>t.width)||(top+d.offsetHeight>t.height)){if(left+d.offsetWidth>t.width)horzPos=mapX-((t.width/2)/zoomPower)+((d.offsetWidth+offsetPosition.x)/zoomPower);if(left<0)horzPos=mapX+((t.width/2)/zoomPower)+((offsetPosition.x)/zoomPower);if(top+d.offsetHeight>t.height)vertPos=mapY-((t.height/2)/zoomPower)+((d.offsetHeight+offsetPosition.y)/zoomPower);if(top<0)vertPos=mapY+((t.height/2)/zoomPower)+((offsetPosition.y)/zoomPower);t.setCenterPosition(new Coordinate(horzPos,vertPos));}}};t.addTileOverlayToMap=function(overlay,isStretch){var overlayName=overlay.getName();var imgUrl=overlay.getImgUrl();var leftUpCoordinate=overlay.getLeftUpCoordinate();var rightDownCoordinate=overlay.getRightDownCoordinate();var mapSize=t.getSize();var zoomPower=flash.getVariable("ZoomPower")-0;var centerPosition=t.getCenterPosition();if(isStretch!=null){if(isStretch==true)isStretch=true;else isStretch=false;}else isStretch=true;var screenCoordinateLeftUp=new ScreenCoordinate(((leftUpCoordinate.getMapX()-centerPosition.getMapX())*zoomPower)+mapSize.width/2,((leftUpCoordinate.getMapY()-centerPosition.getMapY())*zoomPower)+mapSize.height/2);if(screenCoordinateLeftUp==null){var xLeftUp=0;var yLeftUp=0}else{var xLeftUp=screenCoordinateLeftUp.x;var yLeftUp=screenCoordinateLeftUp.y}var screenCoordinateRightDown=new ScreenCoordinate(((rightDownCoordinate.getMapX()-centerPosition.getMapX())*zoomPower)+mapSize.width/2,((rightDownCoordinate.getMapY()-centerPosition.getMapY())*zoomPower)+mapSize.height/2);if(screenCoordinateRightDown==null){var xRightDown=0;var yRightDown=0}else{var xRightDown=screenCoordinateRightDown.x;var yRightDown=screenCoordinateRightDown.y}var screenCoordinateLeftUpZoomPower1=new ScreenCoordinate(((leftUpCoordinate.getMapX()-centerPosition.getMapX())*1)+mapSize.width/2,((leftUpCoordinate.getMapY()-centerPosition.getMapY())*1)+mapSize.height/2);var screenCoordinateRightDownZoomPower1=new ScreenCoordinate(((rightDownCoordinate.getMapX()-centerPosition.getMapX())*1)+mapSize.width/2,((rightDownCoordinate.getMapY()-centerPosition.getMapY())*1)+mapSize.height/2);divWidthZoomPower1=screenCoordinateRightDownZoomPower1.x-screenCoordinateLeftUpZoomPower1.x;divHeightZoomPower1=screenCoordinateRightDownZoomPower1.y-screenCoordinateLeftUpZoomPower1.y;divWidth=xRightDown-xLeftUp;divHeight=yRightDown-yLeftUp;flash.runFunction("","AddTile",imgUrl,leftUpCoordinate.getMapX(),leftUpCoordinate.getMapY(),rightDownCoordinate.getMapX(),rightDownCoordinate.getMapY(),divWidth,divHeight,divWidthZoomPower1,divHeightZoomPower1,overlayName,isStretch);};t.removeTileOverlay=function(tileOverlayName){flash.runFunction("","RemoveTile",tileOverlayName);};t.overlayMouseWheel=function(evt){var delta;if((!is_internet_explorer())&& !(navigator.userAgent.toLowerCase().indexOf('chrome')> -1)&& !(navigator.userAgent.toLowerCase().indexOf('safari')> -1)){delta= -1*evt.detail;if(evt.preventDefault)evt.preventDefault();}else{delta=event.wheelDelta;event.returnValue=false;}flashListener.triggerEvent(t.objectId,Flash.EVENT_FLASH_MOUSE_WHEEL,new Array(""+delta))};t.overlayMouseDown=function(evt){startXMouseJSPos=evt.screenX;startYMouseJSPos=evt.screenY;isMouseJSClick=true;};t.overlayMouseUp=function(evt){startXMouseJSPos=0;startYMouseJSPos=0;isMouseJSClick=false;};t.overlayMouseOut=function(evt){if(isMouseJSClick){startXMouseJSPos=0;startYMouseJSPos=0;isMouseJSClick=false;}};t.overlayMouseMove=function(evt){if(isMouseJSClick){deltaX=evt.screenX-startXMouseJSPos;deltaY=evt.screenY-startYMouseJSPos;if((deltaX!=0)||(deltaY!=0)){startXMouseJSPos=evt.screenX;startYMouseJSPos=evt.screenY;flash.runFunction("","MoveBy",deltaX,deltaY);}}};var getOverlayFromList=function(overlayName,overlaysList){for(var i=0;i<overlaysList.length;i++){if(overlaysList[i][0]!=null){if(overlaysList[i][0].getName()==overlayName){return{overlay:overlaysList[i][0],overlayPos:i,overlayList:overlaysList}}}}return{overlay:null};};var getOverlay=function(overlayName){var overlayParams=getOverlayFromList(overlayName,overlaysListScreen);if(overlayParams.overlay==null){var overlayParams=getOverlayFromList(overlayName,overlaysListMap)}return overlayParams;};t.getOverlay=function(overlayName){var overlayParams=getOverlay(overlayName);return overlayParams.overlay;};t.removeOverlay=function(overlayName){var overlayParams=getOverlay(overlayName);if(overlayParams.overlay!=null){var overlay=overlayParams.overlay;var container=t.getContainer();_domElement=overlay.getDomElement();_domElement.style.left="-10000px";_domElement.style.display='none';var overlaysList=overlayParams.overlayList;overlaysList[overlayParams.overlayPos]=overlaysList[overlaysList.length-1];overlaysList[overlaysList.length-1]=null;overlaysList.length--;if(overlaysList.length==0){flash.runFunction("","SetJSMapMove",false)}}};t.getOverlayElementPosition=function(el){var container=t.getContainer();var containerId=container.id;var pos={x:0,y:0};var x=0;var y=0;while((el.offsetParent)&&(el.offsetParent.id!=containerId)&&(el.tagName.toLowerCase()!='body')){pos.x+=el.offsetLeft;pos.y+=el.offsetTop;el=el.offsetParent;}pos.x+=el.offsetLeft;pos.y+=el.offsetTop;return pos;};var moveMapOverlays=function(x,y){var i;var top;var left;var domElement;while(IsSmoothZoomDragLocked>0){}IsSmoothZoomDragLocked++;var HorzPos=flash.getVariable("HorzPos")-0;var VertPos=flash.getVariable("VertPos")-0;var LiveZoomPower=flash.getVariable("LiveZoomPower")-0;y=Math.round(y*LiveZoomPower);x=Math.round(x*LiveZoomPower);for(i=0;i<overlaysListMap.length;i++){domElement=overlaysListMap[i][0].getDomElement().style;top=parseInt(domElement.top)+y-0;left=parseInt(domElement.left)+x-0;domElement.top=top+"px";domElement.left=left+"px"}flash.runFunction("","MoveByCoords2","0",x,y,"0");IsSmoothZoomDragLocked--};IsSmoothZoomDragLocked=0;var setOverlayPosition=function(newHorzPos,newVertPos,zoomPower){var left,top;for(var i=0;i<overlaysListMap.length;i++){if(overlaysListMap[i][5]=="0"){horzPos=overlaysListMap[i][1]-0;vertPos=overlaysListMap[i][2]-0;left=Math.round(((horzPos-newHorzPos)*zoomPower)+t.width/2+overlaysListMap[i][3]-0);top=Math.round(((vertPos-newVertPos)*zoomPower)+t.height/2+overlaysListMap[i][4]-0);domElement=overlaysListMap[i][0].getDomElement().style;domElement.top=top+"px";domElement.left=left+"px"}else{screenCoordinateLeftUp=t.mapToClient(overlaysListMap[i][0].getLeftUpCoordinate());screenCoordinateRightDown=t.mapToClient(overlaysListMap[i][0].getRightDownCoordinate());if(screenCoordinateLeftUp==null){xLeftUp=0;yLeftUp=0}else{xLeftUp=screenCoordinateLeftUp.x;yLeftUp=screenCoordinateLeftUp.y}if(screenCoordinateRightDown==null){xRightDown=0;yRightDown=0}else{xRightDown=screenCoordinateRightDown.x;yRightDown=screenCoordinateRightDown.y}divWidth=xRightDown-xLeftUp;divHeight=yRightDown-yLeftUp;domElement=overlaysListMap[i][0].getDomElement().style;domElement.top=yLeftUp+"px";domElement.left=xLeftUp+"px";domElement.bottom=xRightDown+"px";domElement.right=yRightDown+"px";if((divWidth>5)||(divHeight>5)){domElement.width=divWidth+"px";domElement.height=divHeight+"px";}else{domElement.width="0px";domElement.height="0px";}domElement.display='';}}};var setMapOverlaysByZoom=function(newHorzPos,newVertPos,zoomPower){var i;var top;var left;var horzPos;var vertPos;var domElement;while(IsSmoothZoomDragLocked>0){}IsSmoothZoomDragLocked++;setOverlayPosition(newHorzPos,newVertPos,zoomPower);flash.runFunction("","ScaleFromJS");IsSmoothZoomDragLocked--};t.setLayersManager=function(_layersManager){t.layersManager=_layersManager;t.layersManager.attachMap(t);};t.getLayersManager=function(){return t.layersManager};t.setLoadingIconPosition=function(_anchor,deltaScreenCoordinate){flash.runFunction("","setLoadingPosition",_anchor,deltaScreenCoordinate.x,deltaScreenCoordinate.y)};t.setLoadingIcon=function(path){flash.runFunction("","setLoadingIconMovie",path)};t.addDefaultNavigationBar=function(screenCoordinate){flash.runFunction("","loadNavigationBar",screenCoordinate.x,screenCoordinate.y);};t.addAdvancedNavigationBar=function(screenCoordinate){flash.runFunction("","loadAdvancedNavigationBar",screenCoordinate.x,screenCoordinate.y);};t.addDragBar=function(screenCoordinate){flash.runFunction("","loadDragBar",screenCoordinate.x,screenCoordinate.y);};t.addCompass=function(screenCoordinate){flash.runFunction("","loadCompass",screenCoordinate.x,screenCoordinate.y);};t.printMap=function(){flash.runFunction("","printMap");};t.setScaleBarPosition=function(_anchor,deltaScreenCoordinate){flash.runFunction("","setScaleBarPosition",_anchor,deltaScreenCoordinate.x,deltaScreenCoordinate.y)};t.setAtlasCTLogoPosition=function(_anchor,deltaScreenCoordinate){flash.runFunction("","setAtlasCTLogoPosition",_anchor,deltaScreenCoordinate.x,deltaScreenCoordinate.y)};t.loadWaitingMessage=function(_anchor,deltaScreenCoordinate){flash.runFunction("","loadWaitingMessage",_anchor,deltaScreenCoordinate.x,deltaScreenCoordinate.y)};t.showWaitingMessage=function(){flash.runFunction("","showWaitingMessage");};t.hideWaitingMessage=function(){flash.runFunction("","hideWaitingMessage");};t.parserArgs=function(evt,args){switch(evt){case Flash.EVENT_FLASH_INITIALIZE:splitArgs=args.split("^");t.width=splitArgs[0];t.height=splitArgs[1];t.projection=splitArgs[2];flash.runFunction("","InitializeMap");setMapSettings();break;case Flash.EVENT_FLASH_MOUSE_OUT:t.hideCursor();break;case Flash.EVENT_FLASH_MOUSE_WHEEL:flash.runFunction("","onJSMouseWheel",args);break;case Map.EVENT_MAP_INITIALIZE:t.setLayersManager(t.layersManager);t.isMapInitialized=true;if(doMapInitialize){flash.runFunction("","DoFirstLoad")}else{t.setCenterPosition(initializeObject,initializeZoomLevel)}flash.allowRunFunction=true;flash.doCommandsQueue("");flashListener.removeListener(t.objectId,this.flashCallBackEvent,Flash.EVENT_FLASH_INITIALIZE);break;case Map.EVENT_CUSTOM_CTRL_LOADED:flash.doCommandsQueue(CUSTOM_CTRL_MOVIE_PATH);t.layersManager.redraw();break;case Map.EVENT_MAP_MODIFIED:var HorzPos=flash.getVariable("HorzPos")-0;var VertPos=flash.getVariable("VertPos")-0;var LiveZoomPower=flash.getVariable("ZoomPower")-0;setOverlayPosition(HorzPos,VertPos,LiveZoomPower);break;case Map.EVENT_MAP_LOADED:t.isMapFirstLoaded=true;break;case Map.EVENT_MAP_CLICK:splitArgs=args.split("^");return new Array(projector.createClientCoordinate(splitArgs[0],splitArgs[1]));break;case Map.EVENT_MAP_DOUBLE_CLICK:splitArgs=args.split("^");return new Array(projector.createClientCoordinate(splitArgs[0],splitArgs[1]));break;case Map.EVENT_MAP_MOUSE_MOVE:splitArgs=args.split("^");return new Array(projector.createClientCoordinate(splitArgs[0],splitArgs[1]));break;case Map.EVENT_MAP_MOUSE_DOWN:splitArgs=args.split("^");return new Array(projector.createClientCoordinate(splitArgs[0],splitArgs[1]));break;case Map.EVENT_MAP_DRAG_START:splitArgs=args.split("^");return new Array(projector.createClientCoordinate(splitArgs[0],splitArgs[1]));break;case Map.EVENT_MAP_DRAG:splitArgs=args.split("^");return new Array(projector.createClientCoordinate(splitArgs[0],splitArgs[1]));break;case Map.EVENT_MAP_DRAG_JS:splitArgs=args.split("^");moveMapOverlays(splitArgs[0]-0,splitArgs[1]-0);break;case Map.EVENT_MAP_ZOOM_JS:splitArgs=args.split("^");setMapOverlaysByZoom(splitArgs[0]-0,splitArgs[1]-0,splitArgs[2]-0);break;case Map.EVENT_MAP_SMOOTH_ZOOM:splitArgs=args.split("^");return new Array(args);break;case Map.EVENT_MAP_DRAG_END:splitArgs=args.split("^");return new Array(projector.createClientCoordinate(splitArgs[0],splitArgs[1]));break;case Map.EVENT_MAP_RESIZE:splitArgs=args.split("^");t.width=splitArgs[0];t.height=splitArgs[1];var overlay=null;for(var i=0;i<overlaysListScreen.length;i++){overlay=overlaysListScreen[i][0];setDomElementScreenPos(overlay.getDomElement(),overlay.getOffsetPosition(),overlaysListScreen[i][1],overlaysListScreen[i][2])}return new Array(new MapSize(t.width,t.height));break;case Map.EVENT_GEO_RESULT:return new Array(args);break;case Map.EVENT_ADDRESS_ICON_CLICK:splitArgs=args.split("^");return new Array(new ScreenCoordinate(splitArgs[0],splitArgs[1]));break;case Map.EVENT_CONTEXT_MENU_ITEM_CLICK:splitArgs=args.split("^");contextMenu.onContextMenuItemClicked(splitArgs[0],projector.createClientCoordinate(splitArgs[1],splitArgs[2]));break;case Map.EVENT_FLASH_ROUTE_LOADED:if(t.isMapInitialized){t.routeVectorLayer.onRouteFlashLoaded();}break;case Map.EVENT_FLASH_OVERLAY_LOADED:for(var i=0;i<flashMapOverlayList.length;i++){if(flashMapOverlayList[i].getName()==args){flashMapOverlayList[i].onFlashLoaded();}}return new Array(args);break;case Map.EVENT_LOAD_ADVERTISEMENT:t.setBgColor("FFFFFF");break;case Map.EVENT_UNLOAD_ADVERTISEMENT:t.setBgColor("EAEADB");break;default:__my_trace("parserArgs => 'evt' unrecognized: "+evt);break;}return new Array(args);}};function disableClickEvent(evt){if((!is_internet_explorer())&& !(navigator.userAgent.toLowerCase().indexOf('chrome')> -1)&& !(navigator.userAgent.toLowerCase().indexOf('safari')> -1)){if(evt.preventDefault)evt.preventDefault();}else{alert(evt.keyCode);evt.returnValue=false;}};Map.MODE_PAN="drag";Map.MODE_ZOOM_IN="zoomin";Map.MODE_ZOOM_OUT="zoomout";Map.MODE_SMOOTH_ZOOM_IN="smoothzoomin";Map.MODE_SMOOTH_ZOOM_OUT="smoothzoomout";Map.MODE_INSERT_POLYGON="insertpolygon";Map.MODE_INSERT_POLYLINE="insertpolyline";Map.MODE_INSERT_CIRCLE="insertcircle";Map.MODE_INSERT_POINT="insertpoint";Map.MODE_EDIT_SHAPE="editshape";Map.MODE_MEASURE="measure";Map.MODE_MEASURE_EX="measureex";Map.EVENT_MAP_INITIALIZE="onmapinitialize";Map.EVENT_MAP_MODIFIED="onmapmodified";Map.EVENT_MAP_LOADED="onmaploaded";Map.EVENT_MAP_CLICK="onmapclick";Map.EVENT_MAP_DOUBLE_CLICK="onmapdoubleclick";Map.EVENT_MAP_MOUSE_MOVE="onmapmousemove";Map.EVENT_MAP_DRAG_START="onmapdragstart";Map.EVENT_MAP_DRAG_END="onmapdragend";Map.EVENT_MAP_RESIZE="onmapresize";Map.EVENT_GEO_RESULT="ongeoresult";Map.EVENT_ADDRESS_ICON_CLICK="onaddressiconclick";Map.EVENT_CUSTOM_CTRL_LOADED="oncustomctrlloaded";Map.EVENT_FLASH_ROUTE_LOADED="onflashrouteloaded";Map.EVENT_FLASH_OVERLAY_LOADED="flashoverlayloaded";Map.EVENT_MAP_LOADING="onmaploading";Map.EVENT_MAP_DRAG="onmapdrag";Map.EVENT_MAP_SMOOTH_ZOOM="onmapzoom";Map.EVENT_MAP_MOUSE_DOWN="onmapmousedown";Map.EVENT_MAP_DRAG_JS="onmapdragjs";Map.EVENT_MAP_ZOOM_JS="onmapzoomjs";Map.EVENT_CONTEXT_MENU_ITEM_CLICK="oncontextmenuitemclick";Map.EVENT_SEARCH_RESULT="onsearchdisplayresult";Map.EVENT_LOAD_ADVERTISEMENT="onloadadvertisement";Map.EVENT_UNLOAD_ADVERTISEMENT="onunloadadvertisement";Map.VIEW_VECTOR="vector";Map.VIEW_RASTER="raster";Map.VIEW_SATELLITE="satellite";Map.VIEW_HYBRID="hybrid";Map.VIEW_OSM="osm";Map.UNIT_METRIC="metric";Map.UNIT_IMPERIAL="imperial";Map.ALIGN_TOP_LEFT="0";Map.ALIGN_TOP_CENTER="1";Map.ALIGN_TOP_RIGHT="2";Map.ALIGN_CENTER_LEFT="3";Map.ALIGN_CENTER_CENTER="4";Map.ALIGN_CENTER_RIGHT="5";Map.ALIGN_BOTTOM_LEFT="6";Map.ALIGN_BOTTOM_CENTER="7";Map.ALIGN_BOTTOM_RIGHT="8";var CUSTOM_CTRL_MOVIE_PATH="/:ExternalDynamicLayers/AtlasCtrl";OverviewMap.prototype=new EventListener();function OverviewMap(width,height,parentMap,_overviewZoomDelta){this.EventListener=EventListener;this.EventListener();var t=this;width+="";height+="";this.width=width.replace("%","%25");this.height=height.replace("%","%25");this.parentMap=parentMap;var isFlashInitialized=false;if((_overviewZoomDelta==null)||(isNaN(_overviewZoomDelta-0))){_overviewZoomDelta=clientSettings.overviewZoomDelta}else if(_overviewZoomDelta<1)_overviewZoomDelta=1;var overviewZoomDelta=_overviewZoomDelta;var overviewMinZoomDelta=clientSettings.overviewMinZoomDelta;this.bgColor="EAEADB";var flash=new Flash();holdFlashObjectsArr.push(this);t.addFlashEvent=true;this.flashCallBackEvent=function(evt,args){t.triggerEvent(evt,args)};flashListener.addListener(t.objectId,this.flashCallBackEvent,Flash.EVENT_FLASH_INITIALIZE);var onParentMapInitialize=function(){if(isFlashInitialized){coordinate=parentMap.getCenterPosition();zoomLevel=parentMap.getZoomLevel();minZoomLevel=parentMap.getMinZoomLevel()-overviewMinZoomDelta;maxZoomLevel=parentMap.getMaxZoomLevel();mapBounds=parentMap.getBounds();var parentMapSize=parentMap.getSize();flash.runFunction("","InitOverviewMapParams",coordinate.getMapX(),coordinate.getMapY(),Math.pow(2,zoomLevel-overviewZoomDelta),Math.pow(2,minZoomLevel),Math.pow(2,maxZoomLevel),parentMapSize.width,parentMapSize.height,Math.pow(2,zoomLevel),overviewZoomDelta,overviewMinZoomDelta,mapBounds.topLeft.getMapX(),mapBounds.topLeft.getMapY(),mapBounds.bottomRight.getMapX(),mapBounds.bottomRight.getMapY());parentMap.addListener(Map.EVENT_MAP_LOADING,onParentMapLoading,parentMap);parentMap.addListener(Map.EVENT_MAP_DRAG,onParentMapDrag,parentMap);parentMap.addListener(Map.EVENT_MAP_SMOOTH_ZOOM,onParentMapSmoothZoom,parentMap);parentMap.addListener(Map.EVENT_MAP_RESIZE,onParentMapResized,parentMap);}};var onParentMapLoading=function(aa,coordinate){coordinate=parentMap.getCenterPosition();};var onParentMapDrag=function(aa,coordinate){t.MoveByCoords(coordinate.getMapX(),coordinate.getMapY())};var onParentMapSmoothZoom=function(aa,args){splitArgs=args.split("^");t.SmoothZoomDeltaByCoords(splitArgs[0],splitArgs[1],splitArgs[2],splitArgs[3],splitArgs[4])};var onParentMapResized=function(aa,args){coordinate=parentMap.getCenterPosition();flash.runFunction("","LoadMap",coordinate.getMapX(),coordinate.getMapY(),Math.pow(2,parentMap.getZoomLevel()-overviewZoomDelta))};parentMap.addListener(Map.EVENT_MAP_INITIALIZE,onParentMapInitialize,parentMap);flashListener.addListener(t.objectId,this.flashCallBackEvent,Map.EVENT_MAP_DRAG);flashListener.addListener(t.objectId,this.flashCallBackEvent,Flash.EVENT_FLASH_MOUSE_OUT);t.toString=function(){return "overviewMap"};t.writeMap=function(){holdFlashObjectsArrCount++;this.flashId="AtlasMap"+holdFlashObjectsArrCount;var c=clientSettings;flash.init(this.flashId,this.width,this.height,c.swfSource,this.bgColor,true,this.objectId);flash.addArg("Server",c.server);flash.addArg("Dll",c.dll);flash.addArg("customCtrl",c.customCtrl);flash.addArg("MapWidth",t.width);flash.addArg("MapHeight",t.height);flash.addArg("FlashId",t.objectId);flash.addArg("FlashMode","overview");flash.addArg("UD",c.UD);flash.addArg("SessionId",c.sessionId);flash.addArg("MapVersion",c.mapVer);flash.writeFlash()};t.getFlash=function(){return flash;};t.setBgColor=function(bgColor){if((bgColor=="")||(bgColor==null))bgColor="EAEADB";this.bgColor=bgColor;var div=document.getElementById("Div"+this.flashId);if(div!=null)div.style.backgroundColor=this.bgColor};t.getBgColor=function(bgColor){return this.bgColor};t.setSize=function(mapSize){var div=document.getElementById("Div"+flash.id);div.style.width=mapSize.width;div.style.height=mapSize.width;flash.object.style.width=mapSize.width;flash.object.style.height=mapSize.width};t.getSize=function(){return new MapSize(flash.getVariable("MapWidth"),flash.getVariable("MapHeight"))};t.setView=function(view){flash.runFunction("","ChangeView",view)};t.getView=function(){return flash.getVariable("MapView")};t.setOverviewMinZoomDelta=function(newOverviewMinZoomDelta){overviewMinZoomDelta=newOverviewMinZoomDelta};t.getOverviewMinZoomDelta=function(){return overviewMinZoomDelta};t.SmoothZoomDeltaByCoords=function(posX,posY,ZoomDelta,parentMapSmoothZoomPower,parentMapZoomPower){flash.runFunction("","OverviewSmoothZoomDelta",posX,posY,ZoomDelta,parentMapSmoothZoomPower,parentMapZoomPower)};t.MoveByCoords=function(deltaX,deltaY){flash.runFunction("","MoveByCoords",deltaX,deltaY)};t.getZoomLevel=function(){return Math.log(flash.getVariable("ZoomPower"))/Math.log(2)};t.setProjection=function(newProjection){flash.runFunction("","setMapProjection",newProjection)};var setCenterPosition=function(arg,zoomLevel){switch(arg.toString().toLowerCase()){case "coordinate":flash.runFunction("","SetMapPosition",arg.getMapX(),arg.getMapY(),Math.pow(2,zoomLevel));break;}};t.hideCursor=function(){flash.runFunction("","HideCursor")};t.parserArgs=function(evt,args){switch(evt){case Flash.EVENT_FLASH_INITIALIZE:isFlashInitialized=true;flash.runFunction("","InitializeMap");if(parentMap.isMapInitialized){onParentMapInitialize()}break;case Flash.EVENT_FLASH_MOUSE_OUT:t.hideCursor();break;case Map.EVENT_MAP_DRAG:splitArgs=args.split("^");parentMap.MoveByCoords(splitArgs[0],splitArgs[1]);break;case Map.EVENT_MAP_RESIZE:break;}return "";}};function ClientSettings(_server,_dll,_customCtrl,_sessionId,_ud,_mapVer,_clientVer,_guiLang,_appId){var t=this;t.server=_server;t.dll=_dll;t.customCtrl=_customCtrl;t.sessionId=_sessionId;t.UD=_ud;t.mapVer=_mapVer;t.guiLang=_guiLang;t.swfSource="http://api.atlasct.co.il/SDK_V4/Kernel/RemoteFlash8New.swf?"+_clientVer;t.autoSuggestSwfSource="http://api.atlasct.co.il/SDK_V4/Kernel/AutoSuggest.swf?"+_clientVer;t.lbsSwfSource="http://api.atlasct.co.il/SDK_V4/Kernel/LBS.swf?"+_clientVer;t.overviewZoomDelta=3;t.overviewMinZoomDelta=1;t.defaultCountryCode="isr";t.defaultLanguage="";t.defaultEncoding="utf8";t.appId=_appId};clientSettings=new ClientSettings("","","",atSessionId,atKey,atMapVer,atFlashVer,atGuiLang,atAppId);var holdFlashObjectsArr=new Array();holdFlashObjectsArrCount=0;Geocode.prototype=new EventListener();function Geocode(){this.EventListener=EventListener;this.EventListener();var t=this;var id=null;t.resultId=null;t.resultCode=null;t.resultDescription=null;t.geoResult=null;t.geoResultList=null;t.geoBounds=null;t.geoMinZoomLevel=null;t.geoMaxZoomLevel=null;t.geoIP=null;t.addFlashEvent=true;this.flashCallBackEvent=function(evt,args){t.triggerEvent(evt,args)};flashListener.addListener(t.objectId,this.flashCallBackEvent,Geocode.EVENT_GEO_RESULT);t.GeocodeWindowLoaded=function(){var newTarget=document.createElement("div");newTarget.id="Div"+holdFlashObjectsArrCount;newTarget.style.position="absolute";newTarget.style.top="0px";newTarget.style.left="0px";newTarget.style.width="0.1px";newTarget.style.overflow="hidden";newTarget.innerHTML=flash.getHtmlFlashTag();document.body.appendChild(newTarget);flash.object=eval("document."+t.flashId);flashListener.addListener(t.objectId,t.flashCallBackEvent,Flash.EVENT_FLASH_INITIALIZE)};if(holdFlashObjectsArr.length==0){var flash=new Flash();holdFlashObjectsArrCount++;this.flashId="AtlasGeoCode"+holdFlashObjectsArrCount;var c=clientSettings;flash.init(this.flashId,100,100,c.swfSource,this.bgColor,true);flash.addArg("Server",c.server);flash.addArg("Dll",c.dll);flash.addArg("MapWidth",0);flash.addArg("MapHeight",0);flash.addArg("FlashId",t.objectId);flash.addArg("UD",c.UD);flash.addArg("SessionId",c.sessionId);flash.addArg("MapVersion",c.mapVer);if(document.addEventListener){document.addEventListener("DOMContentLoaded",this.GeocodeWindowLoaded,null);}else{window.attachEvent('onload',this.GeocodeWindowLoaded)}holdFlashObjectsArr.push(this)}t.toString=function(){return "geocode"};t.getFlash=function(){return flash;};t.setId=function(_id){id=_id};t.getId=function(){return id;};t.addressToCoordinate=function(address,countryCodeOrSettingsRequest){t.resultCode=null;t.geoResult=null;t.geoResultList=null;if(arguments.length>1){if(countryCodeOrSettingsRequest.type==null){countryCodeValue=countryCodeOrSettingsRequest;countryCodeOrSettingsRequest=new SettingsRequest(countryCodeValue,"","","","","");}}else countryCodeOrSettingsRequest=new SettingsRequest("","","","","","");var flash=holdFlashObjectsArr[0].getFlash();address.country=countryCodeOrSettingsRequest.countryCode;if(countryCodeOrSettingsRequest.language!="")theLanguage=countryCodeOrSettingsRequest.language;else theLanguage=clientSettings.defaultLanguage;theResultsLimit=countryCodeOrSettingsRequest.resultsLimit;thePoiCategories=countryCodeOrSettingsRequest.poiCategories;theMinGrade=countryCodeOrSettingsRequest.minGrade;if((address.street!=null)||(address.city!=null)){street=encoding.fixTextForUTF8(address.street);city=encoding.fixTextForUTF8(address.city);flash.runFunction("","AddressToPoint",address.houseNumber,street,city,address.state,address.zipCode,address.country,"",t.objectId,theLanguage,theResultsLimit,thePoiCategories,theMinGrade);}else{fullAddress=encoding.fixTextForUTF8(address.fullAddress);flash.runFunction("","AddressToPoint","","","","","",address.country,fullAddress,t.objectId,theLanguage,theResultsLimit,thePoiCategories,theMinGrade);}};t.ipToCoordinate=function(theIP){t.resultCode=null;t.geoResult=null;t.geoResultList=null;var flash=holdFlashObjectsArr[0].getFlash();if(arguments.length==0)theIP="";flash.runFunction("","IPToPoint",theIP+" ",t.objectId);};t.coordinateToAddress=function(coordinate,settingsRequest){t.resultCode=null;t.geoResult=null;t.geoResultList=null;var flash=holdFlashObjectsArr[0].getFlash();if(arguments.length>1)theSettingsRequest=settingsRequest;else theSettingsRequest=new SettingsRequest("","","","","","");theCountryCode=theSettingsRequest.countryCode;if(theSettingsRequest.language!="")theLanguage=theSettingsRequest.language;else theLanguage=clientSettings.defaultLanguage;theResultsLimit=theSettingsRequest.resultsLimit;thePoiCategories=theSettingsRequest.poiCategories;theMinGrade=theSettingsRequest.minGrade;flash.runFunction("","PointToAddress",coordinate.getMapX(),coordinate.getMapY(),t.objectId,theCountryCode,theLanguage,theResultsLimit,thePoiCategories,theMinGrade)};t.initGeocodeByArray=function(splitArgs){documentId=splitArgs[0];if(documentId=="geoip"){t.resultId="geoip";theStatus="-1";theIP="";theLat="";theLong="";theZoomLevel="";theCountryCode="";theCountryName="";theRegion="";theCity="";thePostalCode="";theAreaCode="";for(i=1;i<splitArgs.length;i++){splitArgsValues=splitArgs[i].split("|");switch(splitArgsValues[0]){case "status":theStatus=splitArgsValues[1];break;case "ip":theIP=splitArgsValues[1];break;case "latitude":theLat=splitArgsValues[1];break;case "longitude":theLong=splitArgsValues[1];break;case "zoomlevel":theZoomLevel=splitArgsValues[1];break;case "countrycode":theCountryCode=splitArgsValues[1];break;case "countryname":theCountryName=splitArgsValues[1];break;case "region":theRegion=splitArgsValues[1];break;case "city":theCity=splitArgsValues[1];break;case "postalcode":thePostalCode=splitArgsValues[1];break;case "areacode":theAreaCode=splitArgsValues[1];break;}}t.resultCode=theStatus;t.geoIP=new GeoIP(theIP,theLat,theLong,theZoomLevel,theCountryCode,theCountryName,theRegion,theCity,thePostalCode,theAreaCode);t.geoResult=t.geoIP;}else{t.resultId="geocode";t.resultCode=splitArgs[0]-0;if((t.resultCode==1)||(t.resultCode== -1)||(t.resultCode== -6)){var horzPos=splitArgs[1];var vertPos=splitArgs[2];var zoomPower=splitArgs[3];var zoomLevel;if(zoomPower=="")zoomLevel="";else zoomLevel=Math.log(zoomPower)/Math.log(2);var houseNumber=splitArgs[4];var street=splitArgs[5];var city=splitArgs[6];var state=splitArgs[7];var zipCode=splitArgs[8];var country=splitArgs[9];var fullAddress=splitArgs[10];if(splitArgs.length>11){var zPos=splitArgs[11];var theName=splitArgs[12];var theDescription=splitArgs[13];var statusCode=splitArgs[14];var statusDescription=splitArgs[15];var hrefIcon=splitArgs[16];var north=splitArgs[17];var south=splitArgs[18];var east=splitArgs[19];var west=splitArgs[20];var minZoomLevel=splitArgs[21];var maxZoomLevel=splitArgs[22];var adminAreasStr=splitArgs[23];var simpleDataStr=splitArgs[24];var countryCode=splitArgs[25];var generalNorth=splitArgs[26];var generalSouth=splitArgs[27];var generalEast=splitArgs[28];var generalWest=splitArgs[29];var generalMinZoomLevel=splitArgs[30];var generalMaxZoomLevel=splitArgs[31];t.resultDescription=splitArgs[32];t.geoBounds=new MapBounds(projector.createClientCoordinate(generalWest,generalNorth),projector.createClientCoordinate(generalEast,generalSouth));t.geoMinZoomLevel=generalMinZoomLevel;t.geoMaxZoomLevel=generalMaxZoomLevel;t.geoResult=new Address(houseNumber,street,city,state,zipCode,country,fullAddress,projector.createClientCoordinate(horzPos,vertPos),zoomLevel,zPos,theName,theDescription,statusCode,statusDescription,hrefIcon,new MapBounds(projector.createClientCoordinate(west,north),projector.createClientCoordinate(east,south)),minZoomLevel,maxZoomLevel,adminAreasStr,simpleDataStr,countryCode)}else t.geoResult=new Address(houseNumber,street,city,state,zipCode,country,fullAddress,projector.createClientCoordinate(horzPos,vertPos),zoomLevel)}else if(t.resultCode==2){var numberOfAddresses=splitArgs[1];t.geoResultList=new Array(numberOfAddresses);var pos=9;if(splitArgs.length>11){var generalNorth=splitArgs[2];var generalSouth=splitArgs[3];var generalEast=splitArgs[4];var generalWest=splitArgs[5];var generalMinZoomLevel=splitArgs[6];var generalMaxZoomLevel=splitArgs[7];t.resultDescription=splitArgs[8];}for(i=0;i<numberOfAddresses;i++){var horzPos=splitArgs[pos];var vertPos=splitArgs[pos+1];var zoomPower=splitArgs[pos+2];var zoomLevel;if(zoomPower=="")zoomLevel="";else zoomLevel=Math.log(zoomPower)/Math.log(2);var houseNumber=splitArgs[pos+3];var street=splitArgs[pos+4];var city=splitArgs[pos+5];var state=splitArgs[pos+6];var zipCode=splitArgs[pos+7];var country=splitArgs[pos+8];var fullAddress=splitArgs[pos+9];if(splitArgs.length>11){var zPos=splitArgs[pos+10];var theName=splitArgs[pos+11];var theDescription=splitArgs[pos+12];var statusCode=splitArgs[pos+13];var statusDescription=splitArgs[pos+14];var hrefIcon=splitArgs[pos+15];var north=splitArgs[pos+16];var south=splitArgs[pos+17];var east=splitArgs[pos+18];var west=splitArgs[pos+19];var minZoomLevel=splitArgs[pos+20];var maxZoomLevel=splitArgs[pos+21];var adminAreasStr=splitArgs[pos+22];var simpleDataStr=splitArgs[pos+23];var countryCode=splitArgs[pos+24];t.geoBounds=new MapBounds(projector.createClientCoordinate(generalWest,generalNorth),projector.createClientCoordinate(generalEast,generalSouth));t.geoMinZoomLevel=generalMinZoomLevel;t.geoMaxZoomLevel=generalMaxZoomLevel;pos+=25;t.geoResultList[i]=new Address(houseNumber,street,city,state,zipCode,country,fullAddress,projector.createClientCoordinate(horzPos,vertPos),zoomLevel,zPos,theName,theDescription,statusCode,statusDescription,hrefIcon,new MapBounds(projector.createClientCoordinate(west,north),projector.createClientCoordinate(east,south)),minZoomLevel,maxZoomLevel,adminAreasStr,simpleDataStr,countryCode)}else{pos+=10;t.geoResultList[i]=new Address(houseNumber,street,city,state,zipCode,country,fullAddress,projector.createClientCoordinate(horzPos,vertPos),Math.log(zoomPower)/Math.log(2))}}t.geoResult=t.geoResultList[0]}else{if(splitArgs.length>11)t.resultDescription=splitArgs[8];t.geoResult=new Address("","","","","","","",projector.createClientCoordinate(null,null),"")}}};t.parserArgs=function(evt,args){switch(evt){case Flash.EVENT_FLASH_INITIALIZE:flash.doCommandsQueue();flashListener.removeListener(t.objectId,this.flashCallBackEvent,Flash.EVENT_FLASH_INITIALIZE);break;case Geocode.EVENT_GEO_RESULT:splitArgs=args.split("^");t.initGeocodeByArray(splitArgs);return new Array(t);break;}};t.decodeStr=function(str){var i;var newstr="";for(i=0;i<str.length;i++){c=str.charCodeAt(i);if((c>=224)&&(c<=250))c=c+1264;newstr+=String.fromCharCode(c);}return(newstr);}};Geocode.EVENT_GEO_RESULT="ongeoresult";BatchGeocode.prototype=new EventListener();function BatchGeocode(){this.EventListener=EventListener;this.EventListener();var t=this;t.geocodeList=new Array();t.geocodeCommands="";t.addFlashEvent=true;this.flashCallBackEvent=function(evt,args){t.triggerEvent(evt,args)};flashListener.addListener(t.objectId,this.flashCallBackEvent,BatchGeocode.EVENT_GEO_RESULT);t.GeocodeWindowLoaded=function(){var newTarget=document.createElement("div");newTarget.id="Div"+holdFlashObjectsArrCount;newTarget.style.position="absolute";newTarget.style.top="0px";newTarget.style.left="0px";newTarget.style.width="0.1px";newTarget.style.overflow="hidden";newTarget.innerHTML=flash.getHtmlFlashTag();document.body.appendChild(newTarget);flash.object=eval("document."+t.flashId);flashListener.addListener(t.objectId,t.flashCallBackEvent,Flash.EVENT_FLASH_INITIALIZE)};if(holdFlashObjectsArr.length==0){var flash=new Flash();holdFlashObjectsArrCount++;this.flashId="AtlasGeoCode"+holdFlashObjectsArrCount;var c=clientSettings;flash.init(this.flashId,100,100,c.swfSource,this.bgColor,true);flash.addArg("Server",c.server);flash.addArg("Dll",c.dll);flash.addArg("MapWidth",0);flash.addArg("MapHeight",0);flash.addArg("FlashId",t.objectId);flash.addArg("UD",c.UD);flash.addArg("SessionId",c.sessionId);flash.addArg("MapVersion",c.mapVer);if(document.addEventListener){document.addEventListener("DOMContentLoaded",this.GeocodeWindowLoaded,null);}else{window.attachEvent('onload',this.GeocodeWindowLoaded)}holdFlashObjectsArr.push(this)}t.toString=function(){return "batchGeocode"};t.getFlash=function(){return flash;};t.addressToPoint=function(address,geocodeId){var geocode=new Geocode();if(geocodeId!=null)geocode.setId(geocodeId);t.geocodeList.push(geocode);t.geocodeCommands+="AtoP,"+address.houseNumber+","+address.street+","+address.city+","+address.state+","+address.zipCode+","+address.country+"|"};t.pointToAddress=function(point,geocodeId){var geocode=new Geocode();if(geocodeId!=null)geocode.setId(geocodeId);t.geocodeList.push(geocode);t.geocodeCommands+="PtoA,"+point.getMapX()+","+point.getMapY()+"|"};t.begin=function(){t.geocodeList.length=0};t.execute=function(){if(t.geocodeList.length>0){var flash=holdFlashObjectsArr[0].getFlash();flash.runFunction("","DoBatchGeoCode",t.geoCodeCommands,t.objectId);t.geocodeCommands=""}};t.parserArgs=function(evt,args){switch(evt){case Flash.EVENT_FLASH_INITIALIZE:flash.doCommandsQueue();flashListener.removeListener(t.objectId,this.flashCallBackEvent,Flash.EVENT_FLASH_INITIALIZE);break;case BatchGeocode.EVENT_GEO_RESULT:splitArgs=args.split("^");var j;var pos=1;for(i=0;i<splitArgs[0];i++){var resultCode=splitArgs[pos]-0;t.geocodeList[i].resultCode=resultCode;switch(resultCode){case 1:var horzPos=splitArgs[pos+1];var vertPos=splitArgs[pos+2];var zoomPower=splitArgs[pos+3];var zoomLevel;if(zoomPower=="")zoomLevel="";else zoomLevel=Math.log(zoomPower)/Math.log(2);var houseNumber=splitArgs[pos+4];var street=splitArgs[pos+5];var city=splitArgs[pos+6];var state=splitArgs[pos+7];var zipCode=splitArgs[pos+8];var country=splitArgs[pos+9];t.geocodeList[i].geoResult=new Address(houseNumber,street,city,state,zipCode,country,projector.createClientPoint(horzPos,vertPos),zoomLevel);pos+=10;break;case 3:var numberOfAddresses=splitArgs[pos+1];t.geocodeList[i].geoResultList=new Array(numberOfAddresses);horzPosList=splitArgs[pos+2].split("~");vertPosList=splitArgs[pos+3].split("~");zoomPowerList=splitArgs[pos+4].split("~");houseNumberList=splitArgs[pos+5].split("~");streetList=splitArgs[pos+6].split("~");cityList=splitArgs[pos+7].split("~");stateList=splitArgs[pos+8].split("~");zipCodeList=splitArgs[pos+9].split("~");countryList=splitArgs[pos+9].split("~");for(j=0;j<numberOfAddresses;j++){var horzPos=horzPosList[j];var vertPos=vertPosList[j];var zoomPower=zoomPowerList[j];var zoomLevel;if(zoomPower=="")zoomLevel="";else zoomLevel=Math.log(zoomPower)/Math.log(2);var houseNumber=houseNumberList[j];var street=streetList[j];var city=cityList[j];var state=stateList[j];var zipCode=zipCodeList[j];var country=countryList[j];t.geocodeList[i].geoResultList[j]=new Address(houseNumber,street,city,state,zipCode,country,projector.createClientPoint(horzPos,vertPos),Math.log(zoomPower)/Math.log(2))}t.geocodeList[i].geoResult=t.geocodeList[i].geoResultList[0];pos+=11;break;default:t.geocodeList[i].geoResult=new Address("","","","","","",projector.createClientPoint(null,null),"");pos+=10}}return new Array(t.geocodeList);break;}}};BatchGeocode.EVENT_GEO_RESULT="ongeoresult";Search.prototype=new EventListener();function Search(){this.EventListener=EventListener;this.EventListener();var t=this;var id=null;t.resultId=null;t.geoResult=null;t.searchResult=null;t.resultCode=null;t.resultDescription=null;t.geoResultList=null;t.searchResultList=null;t.searchBounds=null;t.searchMinZoomLevel=null;t.searchMaxZoomLevel=null;t.searchCategory=null;t.layersearchResultsFlag=false;t.mapObject=null;t.fullTerm=null;t.whatText=null;t.where=null;t.addFlashEvent=true;this.flashCallBackEvent=function(evt,args){t.triggerEvent(evt,args)};flashListener.addListener(t.objectId,this.flashCallBackEvent,Search.EVENT_SEARCH_RESULT);flashListener.addListener(t.objectId,this.flashCallBackEvent,Search.EVENT_SEARCH_DISPLAY_RESULT);t.Category=function(_name,_id){this.name=_name;this.id=_id;this.type="category";this.toString=function(){return "category"}};t.GeocodeWindowLoaded=function(){var newTarget=document.createElement("div");newTarget.id="Div"+holdFlashObjectsArrCount;newTarget.style.position="absolute";newTarget.style.top="0px";newTarget.style.left="0px";newTarget.style.width="0.1px";newTarget.style.overflow="hidden";newTarget.innerHTML=flash.getHtmlFlashTag();document.body.appendChild(newTarget);flash.object=eval("document."+t.flashId);flashListener.addListener(t.objectId,t.flashCallBackEvent,Flash.EVENT_FLASH_INITIALIZE)};if(holdFlashObjectsArr.length==0){var flash=new Flash();holdFlashObjectsArrCount++;this.flashId="AtlasGeoCode"+holdFlashObjectsArrCount;var c=clientSettings;flash.init(this.flashId,100,100,c.swfSource,this.bgColor,true);flash.addArg("Server",c.server);flash.addArg("Dll",c.dll);flash.addArg("MapWidth",0);flash.addArg("MapHeight",0);flash.addArg("FlashId",t.objectId);flash.addArg("UD",c.UD);flash.addArg("SessionId",c.sessionId);flash.addArg("MapVersion",c.mapVer);if(document.addEventListener){document.addEventListener("DOMContentLoaded",this.GeocodeWindowLoaded,null);}else{window.attachEvent('onload',this.GeocodeWindowLoaded)}holdFlashObjectsArr.push(this)}this.type="search";t.toString=function(){return "search"};t.getFlash=function(){return flash;};t.setId=function(_id){id=_id};t.getId=function(){return id;};t.find=function(_SearchRequest,_SettingsRequest){t.resultCode=null;t.searchResult=null;t.searchResultList=null;placeIt=false;if(arguments.length>2){if(arguments[2]==true){placeIt=true;t.mapObject=arguments[3];}}if(arguments.length==0)_SettingsRequest=new SettingsRequest("","","","","","");if(_SettingsRequest.language=="")_SettingsRequest.language=clientSettings.defaultLanguage;var flash=holdFlashObjectsArr[0].getFlash();searchTerms=encoding.fixTextForUTF8(_SearchRequest.searchTerms);var isSimpleSearch=true;if(_SearchRequest.address!=null){_SearchRequest.address.country=_SettingsRequest.countryCode;coordinateStr="";if(_SearchRequest.coordinate!=null){coordinateStr=_SearchRequest.coordinate.getMapX()+","+_SearchRequest.coordinate.getMapY()+" ";}if((_SearchRequest.address.street!=null)||(_SearchRequest.address.city!=null)){street=encoding.fixTextForUTF8(_SearchRequest.address.street);city=encoding.fixTextForUTF8(_SearchRequest.address.city);isSimpleSearch=false;flash.runFunction("","executeSearch",_SearchRequest.address.houseNumber,street,city,_SearchRequest.address.state,_SearchRequest.address.zipCode,_SearchRequest.address.country,"",coordinateStr,searchTerms,_SettingsRequest.poiCategories,t.objectId,"0",placeIt,_SettingsRequest.language,_SettingsRequest.resultsLimit,_SettingsRequest.maxRadius,_SettingsRequest.minGrade,_SettingsRequest.addressId,_SettingsRequest.addressTypeId)}else{fullAddress=encoding.fixTextForUTF8(_SearchRequest.address.fullAddress);isSimpleSearch=false;flash.runFunction("","executeSearch","","","","","",_SearchRequest.address.country,fullAddress,coordinateStr,searchTerms,_SettingsRequest.poiCategories,t.objectId,"0",placeIt,_SettingsRequest.language,_SettingsRequest.resultsLimit,_SettingsRequest.maxRadius,_SettingsRequest.minGrade,_SettingsRequest.addressId,_SettingsRequest.addressTypeId)}}else if(_SearchRequest.coordinate!=null){coordinateStr=_SearchRequest.coordinate.getMapX()+","+_SearchRequest.coordinate.getMapY()+" ";isSimpleSearch=false;flash.runFunction("","executeSearch","","","","","",_SettingsRequest.countryCode,"",coordinateStr,searchTerms,_SettingsRequest.poiCategories,t.objectId,"0",placeIt,_SettingsRequest.language,_SettingsRequest.resultsLimit,_SettingsRequest.maxRadius,_SettingsRequest.minGrade,_SettingsRequest.addressId,_SettingsRequest.addressTypeId)}if(isSimpleSearch)flash.runFunction("","executeSearch","","","","","",_SettingsRequest.countryCode,"","",searchTerms,_SettingsRequest.poiCategories,t.objectId,"1",placeIt,_SettingsRequest.language,_SettingsRequest.resultsLimit,_SettingsRequest.maxRadius,_SettingsRequest.minGrade,_SettingsRequest.addressId,_SettingsRequest.addressTypeId)};t.initSearchByArray=function(splitArgs,placeIt){documentId=splitArgs[0];t.fullTerm=null;t.whatText=null;t.where=null;if(documentId=="localsearch"){t.resultId="localsearch";t.resultCode=splitArgs[1]-0;t.resultDescription=splitArgs[2];if(t.resultCode==1){if(splitArgs[14]=="noaddress"){var numberOfPlacemarks=splitArgs[3];var pos=15;}else{var numberOfPlacemarks=splitArgs[3]-1;var pos=39;}t.searchResultList=new Array(numberOfPlacemarks);var generalNorth=splitArgs[4];var generalSouth=splitArgs[5];var generalEast=splitArgs[6];var generalWest=splitArgs[7];var generalMinZoomLevel=splitArgs[8];var generalMaxZoomLevel=splitArgs[9];var fullTerm=splitArgs[10];var whatText=splitArgs[11];var categoryStr=splitArgs[12];var where=splitArgs[13];t.fullTerm=fullTerm;t.whatText=whatText;t.where=where;t.searchBounds=new MapBounds(projector.createClientCoordinate(generalWest,generalNorth),projector.createClientCoordinate(generalEast,generalSouth));t.searchMinZoomLevel=generalMinZoomLevel;t.searchMaxZoomLevel=generalMaxZoomLevel;if(splitArgs[14]!="noaddress"){var horzPos=splitArgs[14];var vertPos=splitArgs[15];var zoomPower=splitArgs[16];var zoomLevel;if(zoomPower=="")zoomLevel="";else zoomLevel=Math.log(zoomPower)/Math.log(2);var houseNumber=splitArgs[17];var street=splitArgs[18];var city=splitArgs[19];var state=splitArgs[20];var zipCode=splitArgs[21];var country=splitArgs[22];var fullAddress=splitArgs[23];var zPos=splitArgs[24];var theName=splitArgs[25];var theDescription=splitArgs[26];var statusCode=splitArgs[27];var statusDescription=splitArgs[28];var hrefIcon=splitArgs[29];var north=splitArgs[30];var south=splitArgs[31];var east=splitArgs[32];var west=splitArgs[33];var minZoomLevel=splitArgs[34];var maxZoomLevel=splitArgs[35];var adminAreasStr=splitArgs[36];var simpleDataStr=splitArgs[37];var countryCode=splitArgs[38];t.geoResult=new Address(houseNumber,street,city,state,zipCode,country,fullAddress,projector.createClientCoordinate(horzPos,vertPos),zoomLevel,zPos,theName,theDescription,statusCode,statusDescription,hrefIcon,new MapBounds(projector.createClientCoordinate(west,north),projector.createClientCoordinate(east,south)),minZoomLevel,maxZoomLevel,adminAreasStr,simpleDataStr,countryCode);}else t.geoResult=null;for(i=0;i<numberOfPlacemarks;i++){var placemarkName=splitArgs[pos];var placemarkAddress=splitArgs[pos+1];var placemarkPhoneNumber=splitArgs[pos+2];var placemarkDescription=splitArgs[pos+3];var placemarkCategoryName=splitArgs[pos+4];var placemarkCategoryId=splitArgs[pos+5];var placemarkHrefIcon=splitArgs[pos+6];var placemarkHorzPos=splitArgs[pos+7];var placemarkVertPos=splitArgs[pos+8];var placemarkZPos=splitArgs[pos+9];var placemarkNorth=splitArgs[pos+10];var placemarkSouth=splitArgs[pos+11];var placemarkEast=splitArgs[pos+12];var placemarkWest=splitArgs[pos+13];var placemarkMinZoomLevel=splitArgs[pos+14];var placemarkMaxZoomLevel=splitArgs[pos+15];pos+=16;t.searchResultList[i]=new Placemark(placemarkName,placemarkAddress,placemarkDescription,placemarkHrefIcon,new MapBounds(projector.createClientCoordinate(placemarkWest,placemarkNorth),projector.createClientCoordinate(placemarkEast,placemarkSouth)),projector.createClientCoordinate(placemarkHorzPos,placemarkVertPos),placemarkZPos,placemarkPhoneNumber,placemarkCategoryName,placemarkCategoryId,placemarkMinZoomLevel,placemarkMaxZoomLevel)}t.searchResult=t.searchResultList[0]}else if(t.resultCode==2){var numberOfPlacemarks=splitArgs[3];t.searchResultList=new Array(numberOfPlacemarks);var pos=10;var generalNorth=splitArgs[4];var generalSouth=splitArgs[5];var generalEast=splitArgs[6];var generalWest=splitArgs[7];var generalMinZoomLevel=splitArgs[8];var generalMaxZoomLevel=splitArgs[9];t.searchBounds=new MapBounds(projector.createClientCoordinate(generalWest,generalNorth),projector.createClientCoordinate(generalEast,generalSouth));t.searchMinZoomLevel=generalMinZoomLevel;t.searchMaxZoomLevel=generalMaxZoomLevel;for(i=0;i<numberOfPlacemarks;i++){var horzPos=splitArgs[pos];var vertPos=splitArgs[pos+1];var zoomPower=splitArgs[pos+2];var zoomLevel;if(zoomPower=="")zoomLevel="";else zoomLevel=Math.log(zoomPower)/Math.log(2);var houseNumber=splitArgs[pos+3];var street=splitArgs[pos+4];var city=splitArgs[pos+5];var state=splitArgs[pos+6];var zipCode=splitArgs[pos+7];var country=splitArgs[pos+8];var fullAddress=splitArgs[pos+9];var zPos=splitArgs[pos+10];var theName=splitArgs[pos+11];var theDescription=splitArgs[pos+12];var statusCode=splitArgs[pos+13];var statusDescription=splitArgs[pos+14];var hrefIcon=splitArgs[pos+15];var north=splitArgs[pos+16];var south=splitArgs[pos+17];var east=splitArgs[pos+18];var west=splitArgs[pos+19];var minZoomLevel=splitArgs[pos+20];var maxZoomLevel=splitArgs[pos+21];var adminAreasStr=splitArgs[pos+22];var simpleDataStr=splitArgs[pos+23];var countryCode=splitArgs[pos+24];var fullTerm=splitArgs[pos+25];var whatText=splitArgs[pos+26];var categoryStr=splitArgs[pos+27];var where=splitArgs[pos+28];categorySplitArgs=categoryStr.split("~");categoryArr=new Array(categorySplitArgs.length);for(j=0;j<categorySplitArgs.length;j++){categoryNameAndIdSplitArgs=categorySplitArgs[j].split("|");categoryArr[j]=new t.Category(categoryNameAndIdSplitArgs[0],categoryNameAndIdSplitArgs[1]);}pos+=29;t.searchResultList[i]=new Address(houseNumber,street,city,state,zipCode,country,fullAddress,projector.createClientCoordinate(horzPos,vertPos),zoomLevel,zPos,theName,theDescription,statusCode,statusDescription,hrefIcon,new MapBounds(projector.createClientCoordinate(west,north),projector.createClientCoordinate(east,south)),minZoomLevel,maxZoomLevel,adminAreasStr,simpleDataStr,countryCode,fullTerm,whatText,categoryArr,where);}t.searchResult=t.searchResultList[0]}else{}if(placeIt)t.displayResults();}else{t.resultId="geocode";t.resultCode=splitArgs[0]-0;if((t.resultCode==1)||(t.resultCode== -6)){var horzPos=splitArgs[1];var vertPos=splitArgs[2];var zoomPower=splitArgs[3];var zoomLevel;if(zoomPower=="")zoomLevel="";else zoomLevel=Math.log(zoomPower)/Math.log(2);var houseNumber=splitArgs[4];var street=splitArgs[5];var city=splitArgs[6];var state=splitArgs[7];var zipCode=splitArgs[8];var country=splitArgs[9];var fullAddress=splitArgs[10];var zPos=splitArgs[11];var theName=splitArgs[12];var theDescription=splitArgs[13];var statusCode=splitArgs[14];var statusDescription=splitArgs[15];var hrefIcon=splitArgs[16];var north=splitArgs[17];var south=splitArgs[18];var east=splitArgs[19];var west=splitArgs[20];var minZoomLevel=splitArgs[21];var maxZoomLevel=splitArgs[22];var adminAreasStr=splitArgs[23];var simpleDataStr=splitArgs[24];var countryCode=splitArgs[25];var generalNorth=splitArgs[26];var generalSouth=splitArgs[27];var generalEast=splitArgs[28];var generalWest=splitArgs[29];var generalMinZoomLevel=splitArgs[30];var generalMaxZoomLevel=splitArgs[31];t.resultDescription=splitArgs[32];t.searchBounds=new MapBounds(projector.createClientCoordinate(generalWest,generalNorth),projector.createClientCoordinate(generalEast,generalSouth));t.searchMinZoomLevel=generalMinZoomLevel;t.searchMaxZoomLevel=generalMaxZoomLevel;t.searchResult=new Address(houseNumber,street,city,state,zipCode,country,fullAddress,projector.createClientCoordinate(horzPos,vertPos),zoomLevel,zPos,theName,theDescription,statusCode,statusDescription,hrefIcon,new MapBounds(projector.createClientCoordinate(west,north),projector.createClientCoordinate(east,south)),minZoomLevel,maxZoomLevel,adminAreasStr,simpleDataStr,countryCode);t.geoResult=t.searchResult;t.searchResultList=new Array(1);t.searchResultList[0]=t.searchResult;t.geoResultList=t.searchResultList;if(placeIt){t.mapObject.showTargetIcon(t.geoResult.coordinate);t.mapObject.setCenterPosition(t.geoResult.coordinate,zoomLevel,true)}}else if(t.resultCode== -1){var horzPos=splitArgs[1];var vertPos=splitArgs[2];var zoomPower=splitArgs[3];var zoomLevel;if(zoomPower=="")zoomLevel="";else zoomLevel=Math.log(zoomPower)/Math.log(2);var houseNumber="";var street=splitArgs[5];var city=splitArgs[6];var state=splitArgs[7];var zipCode=splitArgs[8];var country=splitArgs[9];var fullAddress=splitArgs[10];t.searchResult=new Address(houseNumber,street,city,state,zipCode,country,fullAddress,projector.createClientCoordinate(horzPos,vertPos),zoomLevel);t.searchResultList=new Array(1);t.searchResultList[0]=t.searchResult;t.geoResultList=t.searchResultList;}else if(t.resultCode==2){var numberOfAddresses=splitArgs[1];t.searchResultList=new Array(numberOfAddresses);var pos=9;if(splitArgs.length>11){var generalNorth=splitArgs[2];var generalSouth=splitArgs[3];var generalEast=splitArgs[4];var generalWest=splitArgs[5];var generalMinZoomLevel=splitArgs[6];var generalMaxZoomLevel=splitArgs[7];t.resultDescription=splitArgs[8];}for(i=0;i<numberOfAddresses;i++){var horzPos=splitArgs[pos];var vertPos=splitArgs[pos+1];var zoomPower=splitArgs[pos+2];var zoomLevel;if(zoomPower=="")zoomLevel="";else zoomLevel=Math.log(zoomPower)/Math.log(2);var houseNumber=splitArgs[pos+3];var street=splitArgs[pos+4];var city=splitArgs[pos+5];var state=splitArgs[pos+6];var zipCode=splitArgs[pos+7];var country=splitArgs[pos+8];var fullAddress=splitArgs[pos+9];if(splitArgs.length>11){var zPos=splitArgs[pos+10];var theName=splitArgs[pos+11];var theDescription=splitArgs[pos+12];var statusCode=splitArgs[pos+13];var statusDescription=splitArgs[pos+14];var hrefIcon=splitArgs[pos+15];var north=splitArgs[pos+16];var south=splitArgs[pos+17];var east=splitArgs[pos+18];var west=splitArgs[pos+19];var minZoomLevel=splitArgs[pos+20];var maxZoomLevel=splitArgs[pos+21];var adminAreasStr=splitArgs[pos+22];var simpleDataStr=splitArgs[pos+23];var countryCode=splitArgs[pos+24];t.searchBounds=new MapBounds(projector.createClientCoordinate(generalWest,generalNorth),projector.createClientCoordinate(generalEast,generalSouth));t.searchMinZoomLevel=generalMinZoomLevel;t.searchMaxZoomLevel=generalMaxZoomLevel;pos+=25;t.searchResultList[i]=new Address(houseNumber,street,city,state,zipCode,country,fullAddress,projector.createClientCoordinate(horzPos,vertPos),zoomLevel,zPos,theName,theDescription,statusCode,statusDescription,hrefIcon,new MapBounds(projector.createClientCoordinate(west,north),projector.createClientCoordinate(east,south)),minZoomLevel,maxZoomLevel,adminAreasStr,simpleDataStr,countryCode)}else{pos+=10;t.searchResultList[i]=new Address(houseNumber,street,city,state,zipCode,country,fullAddress,projector.createClientCoordinate(horzPos,vertPos),Math.log(zoomPower)/Math.log(2))}}t.searchResult=t.searchResultList[0];t.geoResult=t.searchResult;t.geoResultList=t.searchResultList;}else{if(splitArgs.length>11)t.resultDescription=splitArgs[8];t.searchResult=new Address("","","","","","","",projector.createClientCoordinate(null,null),"");t.geoResult=t.searchResult;t.searchResultList=new Array(1);t.searchResultList[0]=t.searchResult;t.geoResultList=t.searchResultList;}}};t.displayResults=function(){var layersManager=t.mapObject.getLayersManager();if(layersManager.getLayerByName("searchResults_basiclayer")==null){layersearchResults=layersManager.createLocalVectorLayer("searchResults_basiclayer");layersearchResults.setClustering(LocalVectorLayer.CLUSTERING_NONE);}if(t.resultCode==1){if(t.layersearchResultsFlag)layersearchResults.removeAll();for(var v=0;v<t.searchResultList.length;v++){theIcon=new ExternalIcon(t.searchResultList[v].hrefIcon);theIcon.setOffsetPosition(new ScreenCoordinate(0,-10));theMarker=new Marker('searchResults|'+v,t.searchResultList[v].coordinate,theIcon,"",t.searchResultList[v].name,true,true);layersearchResults.addShape(theMarker);t.layersearchResultsFlag=true;}t.mapObject.fitMap(layersearchResults);layersearchResults.redraw();}};t.parserArgs=function(evt,args){switch(evt){case Flash.EVENT_FLASH_INITIALIZE:flash.doCommandsQueue();flashListener.removeListener(t.objectId,this.flashCallBackEvent,Flash.EVENT_FLASH_INITIALIZE);break;case Search.EVENT_SEARCH_RESULT:splitArgs=args.split("^");t.initSearchByArray(splitArgs,false);return new Array(t);break;case Search.EVENT_SEARCH_DISPLAY_RESULT:splitArgs=args.split("^");t.initSearchByArray(splitArgs,true);return new Array(t);break;}};t.decodeStr=function(str){var i;var newstr="";for(i=0;i<str.length;i++){c=str.charCodeAt(i);if((c>=224)&&(c<=250))c=c+1264;newstr+=String.fromCharCode(c);}return(newstr);}};Search.EVENT_SEARCH_RESULT="onsearchresult";Search.EVENT_SEARCH_DISPLAY_RESULT="onsearchdisplayresult";Route.prototype=new EventListener();function Route(){this.EventListener=EventListener;this.EventListener();var t=this;t.type="route";t.status= -1;t.locationsArray=new Array();t.locations=new Array();t.resultCode=null;t.maneuversCount=null;t.maneuversList=new Array();t.centerCoordinate=new Coordinate(null,null);t.zoomLevel=null;t.initializeLocations=false;t.lastProcessRouteId=0;t.currentProcessRouteId=null;t.unitSystem=null;t.time=null;t.length=null;t.description=null;var routeType=Route.TYPE_FASTEST;var enableTraffic=false;t.addFlashEvent=true;t.flashCallBackEvent=function(evt,args){t.triggerEvent(evt,args)};flashListener.addListener(t.objectId,this.flashCallBackEvent,Route.EVENT_ROUTE_RESULT);flashListener.addListener(t.objectId,this.flashCallBackEvent,Route.EVENT_ROUTE_LOCATION_CHANGED);flashListener.addListener(t.objectId,this.flashCallBackEvent,Route.EVENT_ROUTE_CHANGED);t.GeoCodeWindowLoaded=function(){var newTarget=document.createElement("div");newTarget.id="Div"+holdFlashObjectsArrCount;newTarget.style.position="absolute";newTarget.style.top="0px";newTarget.style.left="0px";newTarget.style.width="0.1px";newTarget.style.overflow="hidden";newTarget.innerHTML=flash.getHtmlFlashTag();document.body.appendChild(newTarget);flash.object=eval("document."+t.flashId);flashListener.addListener(t.objectId,t.flashCallBackEvent,Flash.EVENT_FLASH_INITIALIZE)};if(holdFlashObjectsArr.length==0){var flash=new Flash();holdFlashObjectsArrCount++;this.flashId="AtlasGeoCode"+holdFlashObjectsArrCount;var c=clientSettings;flash.init(this.flashId,100,100,c.swfSource,this.bgColor,true);flash.addArg("Server",c.server);flash.addArg("Dll",c.dll);flash.addArg("MapWidth",0);flash.addArg("MapHeight",0);flash.addArg("FlashId",t.objectId);flash.addArg("UD",c.UD);flash.addArg("SessionId",c.sessionId);flash.addArg("MapVersion",c.mapVer);if(document.addEventListener){document.addEventListener("DOMContentLoaded",this.GeoCodeWindowLoaded,null);}else{window.attachEvent('onload',this.GeoCodeWindowLoaded)}holdFlashObjectsArr.push(this)}t.toString=function(){return "route"};t.getFlash=function(){return flash;};var checkObject=function(_object){switch(_object.type){case "address":return true;break;case "coordinate":return true;break;}return false;};t.setOriginLocation=function(_object,_CountryCode,_Language){checkInitializeLocations();if(checkObject(_object)){if(arguments.length>1){_object.countryCode=_CountryCode;}if(arguments.length>2){_object.language=_Language;}t.locationsArray.push(_object);t.locations.push(new Geocode())}};t.setDestinationLocation=function(_object,_CountryCode,_Language){checkInitializeLocations();if(checkObject(_object)){if(arguments.length>1){_object.countryCode=_CountryCode;}if(arguments.length>2){_object.language=_Language;}t.locationsArray.push(_object);t.locations.push(new Geocode())}};t.addLocation=function(_object,_CountryCode,_Language){checkInitializeLocations();if(arguments.length>1){_object.countryCode=_CountryCode;}if(arguments.length>2){_object.language=_Language;}switch(_object.type){case "address":t.locationsArray.push(_object);t.locations.push(new Geocode());break;case "coordinate":t.locationsArray.push(_object);t.locations.push(new Geocode());break;}};t.clearLocations=function(){t.locations.length=0;t.locationsArray.length=0};t.enableTraffic=function(){enableTraffic=true;};t.disableTraffic=function(){enableTraffic=false;};t.isTraffic=function(){return enableTraffic;};t.disableTraffic=function(){enableTraffic=false;};t.setType=function(type){routeType=type};t.getType=function(){return routeType;};var checkInitializeLocations=function(){if(t.initializeLocations){t.resultCode=null;t.maneuversCount=null;t.maneuversList.length=0;t.centerCoordinate=new Coordinate(null,null);t.zoomLevel=null;t.locations.length=0;t.locationsArray.length=0;t.initializeLocations=false}};t.execute=function(countryCodeOrSettingsRequest){if(arguments.length>0){if(countryCodeOrSettingsRequest.type==null){countryCode=countryCodeOrSettingsRequest;countryCodeOrSettingsRequest=new SettingsRequest(countryCode,"","","","","");}}else{countryCodeOrSettingsRequest=new SettingsRequest("","","","","","");}theCountryCode=countryCodeOrSettingsRequest.countryCode;if(countryCodeOrSettingsRequest.language!="")theLanguage=countryCodeOrSettingsRequest.language;else theLanguage=clientSettings.defaultLanguage;theResultsLimit=countryCodeOrSettingsRequest.resultsLimit;thePoiCategories=countryCodeOrSettingsRequest.poiCategories;theMinGrade=countryCodeOrSettingsRequest.minGrade;t.status=0;t.lastProcessRouteId++;var oL=t.locationsArray[0];var dL=t.locationsArray[1];var paramsList=new Array("","GetMultiRoute",t.objectId,t.lastProcessRouteId,routeType,theCountryCode,theLanguage,theResultsLimit,thePoiCategories,theMinGrade,enableTraffic);for(var i=0;i<t.locationsArray.length;i++){var l=t.locationsArray[i];var country;if((l.countryCode!=null)&&(l.countryCode!=""))country=l.countryCode;else country=theCountryCode;var lang;if((l.language!=null)&&(l.language!=""))lang=l.language;else lang=theLanguage;switch(l.type){case "address":var houseNumber=l.houseNumber;var street=encoding.fixTextForUTF8(l.street);var city=encoding.fixTextForUTF8(l.city);var state=l.state;var zipCode=l.zipCode;var fullAddress=encoding.fixTextForUTF8(l.fullAddress);var horzPos="";var vertPos="";break;case "coordinate":var horzPos=l.getMapX();var vertPos=l.getMapY();break;}paramsList.push(houseNumber,street,city,state,zipCode,country,fullAddress,horzPos,vertPos,lang);}var flash=holdFlashObjectsArr[0].getFlash();flash.runFunction.apply(this,paramsList);t.initializeLocations=true};t.parserArgs=function(evt,args){switch(evt){case Flash.EVENT_FLASH_INITIALIZE:flash.doCommandsQueue();flashListener.removeListener(t.objectId,this.flashCallBackEvent,Flash.EVENT_FLASH_INITIALIZE);break;case Route.EVENT_ROUTE_RESULT:var separatorIndex=args.indexOf("|");t.currentProcessRouteId=args.substring(0,separatorIndex)-0;args=args.substr(separatorIndex+1);if(t.lastProcessRouteId==t.currentProcessRouteId){splitArgs=args.split("^");t.resultCode=splitArgs[0]-0;if(splitArgs[2].toLowerCase()=="kml"){var pos=3}else{var pos=2}var add;for(i=0;i<splitArgs[1]-0;i++){var resultGeocode=splitArgs[pos]-0;if(splitArgs[2].toLowerCase()=="kml"){if(resultGeocode==2){var numberOfAddressess=splitArgs[pos+1]-0;add=3+(25*numberOfAddressess)}else{if((resultGeocode==1)||(resultGeocode== -1)||(resultGeocode== -6))add=26;else add=2}}else{if(resultGeocode==2){var numberOfAddressess=splitArgs[pos+1]-0;add=3+(10*numberOfAddressess)}else{if((resultGeocode==1)||(resultGeocode== -1))add=11;else add=1}}t.locations[i].initGeocodeByArray(splitArgs.slice(pos,pos+add));pos+=add}if(t.resultCode==1){if(splitArgs[2].toLowerCase()=="kml")pos++;var horzPos=splitArgs[pos];var vertPos=splitArgs[pos+1];var zoomLevel=splitArgs[pos+2];t.centerCoordinate.setCoordinate(horzPos,vertPos);t.zoomLevel=zoomLevel;t.maneuversCount=splitArgs[pos+3];pos+=4;var i;var j;var arrCoordinates;var startdate=new Date();var startSeconds=startdate.getTime();numberOfCoordinates=0;for(i=0;i<t.maneuversCount;i++){trackDesc=splitArgs[pos];trackPos=splitArgs[pos+1];splitTrackPos=trackPos.split(",");trackType=splitArgs[pos+2];trackDirection=splitArgs[pos+3];trackRoad=splitArgs[pos+4];trackLength=splitArgs[pos+5];arrCoordinates=new Array();if(i<t.maneuversCount-1){trackCoordinates=splitArgs[pos+6];numberOfCoordinates+=trackCoordinates.length/2}else trackCoordinates="";if(splitArgs[2].toLowerCase()=="kml"){theName=splitArgs[pos+7];distance=trackDesc;trackDesc=theName;fullAddress=splitArgs[pos+8];simpleDataStr=splitArgs[pos+9];hrefIcon=splitArgs[pos+10];styleUrl=splitArgs[pos+11];timeInfo=splitArgs[pos+12];t.maneuversList.push(new Maneuver(trackDesc,projector.createClientCoordinate(splitTrackPos[0],splitTrackPos[1]),trackType,trackDirection,trackRoad,trackLength,arrCoordinates,trackCoordinates,theName,fullAddress,simpleDataStr,hrefIcon,styleUrl,timeInfo,distance));pos+=13}else{t.maneuversList.push(new Maneuver(trackDesc,projector.createClientCoordinate(splitTrackPos[0],splitTrackPos[1]),trackType,trackDirection,trackRoad,trackLength,arrCoordinates,trackCoordinates));pos+=7}}t.status=1;t.unitSystem=splitArgs[pos];t.time=splitArgs[pos+1];t.length=splitArgs[pos+2];t.description=splitArgs[pos+3];var endDate=new Date();var endSeconds=endDate.getTime();resultTime=(endSeconds-startSeconds)/1000}}return new Array(t);break;case Route.EVENT_ROUTE_CHANGED:var argsList=args.split("~");splitArgs=argsList[1].split("^");var locationsList=t.locationsArray.slice();var newLocation=projector.createClientCoordinate(splitArgs[0],splitArgs[1]);for(var i=0;i<locationsList.length;i++){if(i==(splitArgs[2]-0+1))t.addLocation(projector.createClientCoordinate(splitArgs[0],splitArgs[1]));t.addLocation(locationsList[i]);}return new Array(t,newLocation,route.locationsArray);break;case Route.EVENT_ROUTE_LOCATION_CHANGED:var argsList=args.split("~");splitArgs=argsList[1].split("^");var locationsList=t.locationsArray.slice();var newLocation=projector.createClientCoordinate(splitArgs[0],splitArgs[1]);for(var i=0;i<locationsList.length;i++){if(i==(splitArgs[2]-0))t.addLocation(projector.createClientCoordinate(splitArgs[0],splitArgs[1]));else t.addLocation(locationsList[i]);}return new Array(t,newLocation,route.locationsArray);break;}}};Route.EVENT_ROUTE_RESULT="onrouteresult";Route.EVENT_MANEUVER_CLICK="onmaneuverclick";Route.EVENT_ROUTE_CHANGED="onroutechanged";Route.EVENT_ROUTE_LOCATION_CHANGED="onroutelocationchanged";Route.TYPE_FASTEST="Fastest";Route.TYPE_SHORTEST="Shortest";Route.TYPE_PEDESTRIAN="ByFoot";Route.TYPE_FASTEST_WITH_TOLLWAY="FastestWithTollway";Route.TYPE_SHORTEST_WITH_TOLLWAY="ShortestWithTollway";function RouteVectorLayer(_parentMap){this.EventListener=EventListener;this.EventListener();var t=this;var route=null;var parentMap=_parentMap;t.type="routeVectorLayer";var style=new LineStyle(6,"17F750",60);var routeVisible=false;var animationVisible=true;var maneuversVisible=true;var flagsVisible=true;var routeSpatialArr=null;var isEditable=true;var ROUTE_MOVIE_PATH="/:ExternalDynamicLayers/route";t.toString=function(){return "routeVectorLayer"};t.init=function(_route,_parentMap){route=_route;parentMap=_parentMap;parentMap.addListener(Map.EVENT_MAP_MODIFIED,onMapModified,parentMap);t.initSpatial(route.maneuversCount-1);var startdate=new Date();var startSeconds=startdate.getTime();numberOfCoordinates=0;t.doSpatial(route);var endDate=new Date();var endSeconds=endDate.getTime();resultTime=(endSeconds-startSeconds)/1000;t.initFlashRoute();};var onMapModified=function(){drawRoute();};var drawRoute=function(){if(routeVisible){var flash=parentMap.getFlash();var cvp=parentMap.getClientViewPosition(true);var zoomLevel=parentMap.getZoomLevel();var zoomPower=Math.pow(2,zoomLevel);deltaX=400/zoomPower;deltaY=200/zoomPower;var mapBound=new TBound(cvp.topLeft.getMapX()-deltaX,cvp.topLeft.getMapY()-deltaY,cvp.bottomRight.getMapX()+deltaX,cvp.bottomRight.getMapY()+deltaY);flashLocationsListString=getRouteLocationsByMapPosition(mapBound,zoomPower);flashCoordinatesListString=getRouteCoordinatesByMapPosition(mapBound,zoomLevel);flash.runFunction(ROUTE_MOVIE_PATH,"SetRoute",flashLocationsListString,flashCoordinatesListString)}};var getRouteLocationsByMapPosition=function(mapBound,zoomPower){var locationsNumbersList=new Array();for(i=0;i<route.maneuversList.length;i++){if(isCoordinateInMap(mapBound,route.maneuversList[i].location.getMapX(),route.maneuversList[i].location.getMapY(),10)){showLocation=true;maneuverX=route.maneuversList[i].location.getMapX();maneuverY=route.maneuversList[i].location.getMapY();for(S=0;S<locationsNumbersList.length;S++){X=route.maneuversList[locationsNumbersList[S]].location.getMapX();Y=route.maneuversList[locationsNumbersList[S]].location.getMapY();z=12/zoomPower;if((X-z<maneuverX)&&(Y-z<maneuverY)&&(X+z>maneuverX)&&(Y+z>maneuverY)){showLocation=false}}if(showLocation)locationsNumbersList.push(i)}}return locationsNumbersList.join("^")};var getRouteCoordinatesByMapPosition=function(mapBound,zoomLevel){if(zoomLevel>= -6){z=0}else z=1;var segments=routeSpatialArr[z].segmentsList;var flashCoordinatesList=new Array();var coordinate1,coordinate2,bound,coordinatesList;addDelimiter=false;for(i=0;i<segments.length;i++){if(segments[i]!=null){bound=segments[i].bound;coordinatesList=segments[i].coordinatesList;if(segments[i].coordinatesList.length>0){if(isRectanglesOverlappingMap(mapBound,bound.x1,bound.y1,bound.x2,bound.y2)){isFirstSegment=true;coordinateX1=coordinatesList[0];coordinateY1=coordinatesList[1];for(j=2;j<coordinatesList.length;j=j+2){coordinateX2=coordinatesList[j];coordinateY2=coordinatesList[j+1];if(isRectanglesOverlappingMap(mapBound,Math.min(coordinateX1,coordinateX2),Math.min(coordinateY1,coordinateY2),Math.max(coordinateX1,coordinateX2),Math.max(coordinateY1,coordinateY2))){if(addDelimiter){flashCoordinatesList.push("|");addDelimiter=false}if(isFirstSegment){flashCoordinatesList.push(coordinateX1);flashCoordinatesList.push(coordinateY1);isFirstSegment=false}flashCoordinatesList.push(coordinateX2);flashCoordinatesList.push(coordinateY2)}else{addDelimiter=true}coordinateX1=coordinateX2;coordinateY1=coordinateY2}}}}}resultString=flashCoordinatesList.join("^");resultString=resultString.replace(/\^\|\^/g,"|");if(resultString.substring(0,2)=="|^")resultString=resultString.substring(2,resultString.length);return resultString;};t.initFlashRoute=function(){routeVisible=true;var flash=parentMap.getFlash();var j;var locationStr;var locationsString="1^"+route.maneuversList[0].location.getMapX()+"^"+route.maneuversList[0].location.getMapY()+"|";for(i=1;i<route.maneuversList.length-1;i++){if(route.maneuversList[i].type.toLowerCase()=="middle")locationStr="M";else locationStr="";locationsString+=locationStr+"^"+route.maneuversList[i].location.getMapX()+"^"+route.maneuversList[i].location.getMapY()+"|"}locationsString+="1^"+route.maneuversList[route.maneuversList.length-1].location.getMapX()+"^"+route.maneuversList[route.maneuversList.length-1].location.getMapY()+"|";flash.runFunction(ROUTE_MOVIE_PATH,"InitRoute",route.objectId,locationsString)};var TBound=function(_x1,_y1,_x2,_y2){this.x1=Math.min(_x1,_x2);this.y1=Math.min(_y1,_y2);this.x2=Math.max(_x1,_x2);this.y2=Math.max(_y1,_y2)};var TSegment=function(_x1,_y1,_x2,_y2){this.coordinatesList=new Array();this.bound=new TBound(_x1,_y1,_x2,_y2)};var TSpatial=function(_distance){this.segmentsList=new Array();this.distance=_distance;this.x=0;this.y=0};var pntToSegmentDistance=function(Px,Py,x1,y1,x2,y2){if((x1==x2)&&(y1==y2)){return Math.round(Math.sqrt(((x1-Px)*(x1-Px))+((y1-Py)*(y1-Py))));}else{Dx=x2-x1;Dy=y2-y1;Ratio=((Px-x1)*Dx+(Py-y1)*Dy)/(Dx*Dx+Dy*Dy);if(Ratio<0){return Math.round(Math.sqrt(((x1-Px)*(x1-Px))+((y1-Py)*(y1-Py))));}else{if(Ratio>1){return Math.round(Math.sqrt(((x2-Px)*(x2-Px))+((y2-Py)*(y2-Py))));}else{x2=(1-Ratio)*x1+Ratio*x2;y2=(1-Ratio)*y1+Ratio*y2;return Math.round(Math.sqrt(((x2-Px)*(x2-Px))+((y2-Py)*(y2-Py))));}}}};function checkMinMaxSegment(z,i,pntX,pntY){var b=routeSpatialArr[z].segmentsList[i].bound;if(pntX<b.x1)b.x1=pntX;else if(pntX>b.x2)b.x2=pntX;if(pntY<b.y1)b.y1=pntY;else if(pntY>b.y2)b.y2=pntY};function isRectanglesOverlappingMap(mapBound,minX,minY,maxX,maxY){if(mapBound.x1>maxX)return false;if(mapBound.x2<minX)return false;if(mapBound.y1>maxY)return false;if(mapBound.y2<minY)return false;return true;};function isCoordinateInMap(mapBound,X,Y,delta){if((mapBound.x1-delta<=X)&&(mapBound.y1-delta<=Y)&&(mapBound.x2+delta>=X)&&(mapBound.y2+delta>=Y))return true;else return false};t.initSpatial=function(segmentsCount){routeSpatialArr=new Array();routeSpatialArr.push(new TSpatial(-1));routeSpatialArr.push(new TSpatial(100));for(z=0;z<routeSpatialArr.length;z++){routeSpatialArr[z].segmentsList=new Array(segmentsCount)}};t.doSpatial=function(route){var j,z,x,y,x1,y1,x2,y2;var rsArr=routeSpatialArr;var i;for(i=0;i<route.maneuversCount;i++){if(i<route.maneuversCount-1){coordinatesList=route.maneuversList[i].coordinatesString.split(",");if(coordinatesList!=""){firstSegmentCoordinateX=coordinatesList[0]-0;firstSegmentCoordinateY=coordinatesList[1]-0;for(z=0;z<rsArr.length;z++){rsArr[z].x=firstSegmentCoordinateX;rsArr[z].y=firstSegmentCoordinateY;rsArr[z].segmentsList[i]=new TSegment(firstSegmentCoordinateX,firstSegmentCoordinateY,firstSegmentCoordinateX,firstSegmentCoordinateY);rsArr[z].segmentsList[i].coordinatesList.push(firstSegmentCoordinateX,firstSegmentCoordinateY)}x1=coordinatesList[2]-0;y1=coordinatesList[3]-0;for(j=4;j<coordinatesList.length-2;j=j+2){x2=coordinatesList[j]-0;y2=coordinatesList[j+1]-0;for(z=0;z<rsArr.length;z++){if(pntToSegmentDistance(x1,y1,rsArr[z].x,rsArr[z].y,x2,y2)>rsArr[z].distance){rsArr[z].segmentsList[i].coordinatesList.push(x1,y1);checkMinMaxSegment(z,i,x1,y1);rsArr[z].x=x1;rsArr[z].y=y1}}x1=x2;y1=y2}lastSegmentCoordinateX=coordinatesList[coordinatesList.length-2]-0;lastSegmentCoordinateY=coordinatesList[coordinatesList.length-1]-0;for(z=0;z<rsArr.length;z++){rsArr[z].x=lastSegmentCoordinateX;rsArr[z].y=lastSegmentCoordinateY;rsArr[z].segmentsList[i].coordinatesList.push(lastSegmentCoordinateX,lastSegmentCoordinateY);checkMinMaxSegment(z,i,lastSegmentCoordinateX,lastSegmentCoordinateY)}}}}};t.setStyle=function(lineStyle){style=lineStyle;var flash=parentMap.getFlash();flash.runFunction(ROUTE_MOVIE_PATH,"SetLineStyle",style.width,style.color,style.alpha)};t.getStyle=function(){return style;};t.hide=function(){routeVisible=false;var flash=parentMap.getFlash();flash.runFunction(ROUTE_MOVIE_PATH,"HideRoute")};t.show=function(){if(!routeVisible){routeVisible=true;drawRoute();var flash=parentMap.getFlash();flash.runFunction(ROUTE_MOVIE_PATH,"ShowRoute")}};t.hideAnimation=function(){showHideAnimation(false)};t.showAnimation=function(){if(!animationVisible)showHideAnimation(true)};var showHideAnimation=function(isShow){animationVisible=isShow;var flash=parentMap.getFlash();flash.runFunction(ROUTE_MOVIE_PATH,"showHideAnimation",isShow)};t.hideManeuvers=function(){showHideManeuvers(false)};t.showManeuvers=function(){if(!maneuversVisible)showHideManeuvers(true)};var showHideManeuvers=function(isShow){maneuversVisible=isShow;var flash=parentMap.getFlash();flash.runFunction(ROUTE_MOVIE_PATH,"showHideManeuvers",isShow)};t.hideFlags=function(){showHideFlags(false)};t.showFlags=function(){if(!flagsVisible)showHideFlags(true)};var showHideFlags=function(isShow){flagsVisible=isShow;var flash=parentMap.getFlash();flash.runFunction(ROUTE_MOVIE_PATH,"showHideFlags",isShow)};t.setEditable=function(_isEditable){isEditable=_isEditable;var flash=parentMap.getFlash();flash.runFunction(ROUTE_MOVIE_PATH,"SetEditable",isEditable)};t.getEditable=function(){return isEditable;};t.onRouteFlashLoaded=function(){var flash=parentMap.getFlash();flash.doCommandsQueue(ROUTE_MOVIE_PATH);};t.clearRoute=function(){if(routeSpatialArr!=null){var flash=parentMap.getFlash();flash.runFunction(ROUTE_MOVIE_PATH,"clearRoute");routeSpatialArr.length=0;parentMap.removeListener(Map.EVENT_MAP_MODIFIED,onMapModified,parentMap);routeVisible=false;routeSpatialArr=null;route=null}}};mapCoordSystem=Projector.ITM_MAPA;
projector.setDefaultProjections(clientCoordSystem,mapCoordSystem);

